.htaccess not working for sub-directories


I have my account setup similar to this: http://wiki.dreamhost.com/Unix_account_setup
where /home/myusername/www/ contains a separate folder for each of the domain/sub-domain hosted on my account.

I have a file: /home/myusername/www/.htaccess with the contents: Options -Indexes
However, this does not disable directory browsing for the website at /home/myusername/www/example.com

When I put Options -Indexes in this file: /home/myusername/www/example.com/.htaccess directory browsing is disabled, as expected.

Both .htaccess files are world readable.

Any idea why the .htaccess file in www/ directory does not disable directory browsing?


probably because apache is not looking there. you’ve indicated in the panel that your root directory is example.com, not www, right? your .htaccess should work from your root directory and below.


That must be it. Are you referring to the “Web Directory” field, which can be modified when clicking “Edit” on this page: https://panel.dreamhost.com/index.cgi?tree=domain.manage ?

Is there any way of having an .htaccess file that is applied to all websites hosted on my account?


yeah uploading a copy of the .htaccess file to each example.com directory

  1. yes.

  2. you could probably make a symlink from the root of every website to a single .htaccess file at your user home. I haven’t tried this, but apache can access files there if it’s directed there from within the document root…