How do you do....it? Thread, Disable directory listing in Technical; I've Googled this for answers, and they tell me to either add *Options -Indexes* to the .htaccess file in the ...
14th May 2008, 07:45 AM #1
Disable directory listing
I've Googled this for answers, and they tell me to either add *Options -Indexes* to the .htaccess file in the root of my site, or to add similar to my http.conf file. I've restarted the Apache server but I can still access various directories.
I'm using the Apache2Triad package on a W2K3 server.
14th May 2008, 09:01 AM #2
In httpd.conf look for the section that looks like
and you should see something like the following after it:
Options Indexes FollowSymLinks
To disable directory listing, just remove ‘Indexes’ from this line or change ‘Indexes’ to ‘-Indexes’
Make sure to restart your Apache server afterwards and clear your webcache if there's any in the way.
Last edited by rob_f; 14th May 2008 at 09:06 AM.
14th May 2008, 09:04 AM #3
The problem you'll have with .htaccess on windows is that you can't actually create a file called .htaccess - you need something before the dot in a filename.
In your httpd.conf file there is a line that should look like
Change this to something else - ht.access or something, restart apache and then you can change settings at a directory level by creating ht.access files in the applicable directory.
14th May 2008, 09:24 AM #4
If you're struggling and need a quick fix, there's always the old chuck a blank index.htm files in directories while you're fighting with it trick
14th May 2008, 10:15 AM #5
Yep, done that plenty times Could also add a meta refresh to redirect. Cheesy, but an option.
14th May 2008, 10:18 AM #6
All viable options , however if you're serious about using apache as a production webserver it's vastly beneficial to get to grips with the httpd.conf file.
21st May 2008, 06:33 PM #7
Sorry to have been away from this post so long. Can I get this clear in my head, are you advocating that I change a line of code in the httpd.conf file, and then rename .htaccess, as well as changing Indexes to -Indexes?
Originally Posted by rob_f
21st May 2008, 07:48 PM #8
Nope, if you modify the indexes directive in httpd.conf then that will apply to everything defined by the directory section.
.htaccess applies to when you make changes like this on a per-directory basis by creating a .htaccess file in a particular directory.
The best way to do things would be to disallow indexes in httpd.conf and then if you need to have a directory index anywhere, create a .htaccess (or indeed ht.access) file in the directory you want listing.
I hope i've made this a little clearer, apologies for my initial conflicting statement!
2 Thanks to rob_f:
beeswax (22nd May 2008), FN-GM (24th June 2008)
22nd May 2008, 08:41 AM #9
Just to update you on this, I eventually found the correct place, *htdocs config* which to modify. Which is now common sense, but at the time appeared tricky. Ta.
By speckytecky in forum Wireless Networks
Last Post: 11th September 2007, 09:53 AM
By ChrisH in forum Scripts
Last Post: 21st May 2007, 11:10 AM
By Geoff in forum Windows Vista
Last Post: 23rd February 2007, 02:07 PM
By wesleyw in forum How do you do....it?
Last Post: 20th December 2006, 01:38 PM
By indiegirl in forum Educational Software
Last Post: 24th July 2006, 11:50 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)