How do I override the Apache file listing?

L

Leif K-Brooks

How do I make Apache use my script for listing files? I want to have it
generate good clean HTML, and the Apache builtin doesn't do that.
 
B

bjg

How do I make Apache use my script for listing files? I want to have it
generate good clean HTML, and the Apache builtin doesn't do that.

You can customize that i think a better way than the following, but i've
forgotten how. You might want to Google 'apache index custom'.

As for what you were thinking of doing, just put a DirectoryIndex
directive in a .htaccess in the dir you want to have custom listing. Or if
it's for all dirs, just put it in a container like

<Directory /whatever>
DirectotyIndex yourcustomscript.php
</Directory>

I think that's right. You could and should just edit the httpd.conf if you
have access to it, save using .htaccess as it takes more resources.
 
L

Leif K-Brooks

brucie said:
add your script to the directoryindex directive.

DirectoryIndex index.html your-script.ext

Thanks, but that's not what I want to do. I need the script to be called
from directories without an index.html (or other DirectoryIndex entry)
to list files, like the ugly Apache one is now. I can't put the script
in every directory.
 
B

brucie

Thanks, but that's not what I want to do.

yes it is
I need the script to be called from directories without an index.html
(or other DirectoryIndex entry) to list files,

if there is no index.html file in the directory then your script will
run and list the files in the directory.
I can't put the script in every directory.

DirectoryIndex index.html /path/to/your/script/your-script.ext
 
G

Guest

Leif K-Brooks said:
How do I make Apache use my script for listing files? I want to have it
generate good clean HTML, and the Apache builtin doesn't do that.

Take another look a the Apache httpd.conf file
You are looking for index.html.var
Set this variable to point to your custom page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top