Jump to content

Recommended Posts

Posted

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.

Posted (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 by rob_f
Posted

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.

Posted
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.
Posted
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?

Posted

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.

  • Thanks 2
Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...