Forum Moderators: phranque

Message Too Old, No Replies

Htaccess: block the list of files?

         

stormshield

4:11 pm on Jan 30, 2006 (gmt 0)

10+ Year Member



Hi guys, how do you block this annoying list of files which comes up when a file doesn't exist? I guess it is some simple code in htaccess?
Thanks

coopster

5:52 pm on Jan 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hi stormshield. The mod_dir [httpd.apache.org] Apache module page should help you understand all you are asking here.

jdMorgan

5:53 pm on Jan 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Generally...

Put an index.html or index.php file in that directory
-or-
Add a DirectroyIndex directive to httpd.conf or .htaccess, specifying the default 'index page' name
-or-
Add the line:
Options -Indexes
to httpd.conf or .htaccess
-or-
Redirect missing-file requests to the home page or a site map.

However, you should only be getting the 'annoying list' for requests with no filename specified. If you specify a filename that does not exist, you should be getting a 404-Not Found response.

I can't give a better answer based on sparse input, but if you look up all of the above directives in the Apache documentation [httpd.apache.org], you should be able to get an idea of what Apache can do and which of those behaviours is what you want.

[added] I suppose this might also be a MultiViews problem, depending on how this 'list of files' corresponds to the requested URL. If you don'r need MultiViews/Content Negotiation, turn it off. [/added]

Jim