Tell apache NOT to serve index.php or html

I have always understood that the way to tell Apache to serve the index.php file was to include these lines in httpd.conf. Right now I am doing local development on OSX, I thought that if I just delete the lines it would stop automatically serving index.php pages if it finds one in a folder.

<IfModule dir_module>
 DirectoryIndex index.html index.php

The reason I want this is because I find it easier to have a listing of the files and folders and just click on the ones I want. Deleting index.html and index.php does not seem to work. Does anybody know how to stop Apache from automatically serving index.php? Thanks

Here’s a resource for the information you want

Basically, find your <Directory> listing in Apache’s conf, remove/comment the DirectoryIndex line if you like (although if there are no index files in the designated directory, shouldn’t be an issue), and then add an Options +Indexes line.

Thanks! That helps a lot!

1 Like

jeffreylees info and advice worked great. But for some reason on most of our Mac’s it could not get it. I found another post that explained if you make a .htaccess file and leave where it says DirectoryIndex blank it will do just that. You you put the .htaccess file in your server root. Doing it this way seemed to work well. We only want this for local development of course.

Your tag looping caffeine is great!!! I am trying to
out of that loop! Thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.