beeswax Posted May 14, 2008 Posted May 14, 2008 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.
rob_f Posted May 14, 2008 Posted May 14, 2008 (edited) 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. Edited May 14, 2008 by rob_f
rob_f Posted May 14, 2008 Posted May 14, 2008 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 AccessFileName .htaccess 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.
OutToLunch Posted May 14, 2008 Posted May 14, 2008 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
Ryan Posted May 14, 2008 Posted May 14, 2008 Yep, done that plenty times Could also add a meta refresh to redirect. Cheesy, but an option.
rob_f Posted May 14, 2008 Posted May 14, 2008 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.
beeswax Posted May 21, 2008 Author Posted May 21, 2008 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. 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 AccessFileName .htaccess 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. 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?
rob_f Posted May 21, 2008 Posted May 21, 2008 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! Rob. 2
beeswax Posted May 22, 2008 Author Posted May 22, 2008 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now