[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] I know this is stupid... Turning Directory Browsing off for a single virtual site using .htaccess - HOWTO



> -----Original Message-----
> From: cobalt-users-admin@xxxxxxxxxxxxxxx
> [mailto:cobalt-users-admin@xxxxxxxxxxxxxxx]On Behalf Of Pablo Jejcic -
> Smartweb
> Sent: 08 April 2004 09:27
> To: cobalt-users@xxxxxxxxxxxxxxx
> Subject: [cobalt-users] I know this is stupid...
>
>
> Hello list!,
> 	I know this is stupid, but I have been goggling for it, and I
> couldn't find an answer (at least one that I understand).
> 	I want to avoid people seeing my directories... For example, if
> someone goes to http://www.xxx.co.uk/yyy/ Now they can see the file on
> that directory, but I don’t want them to!
>
> 	I guess that is some parameter on srm.conf or http.conf but I
> can't figure it out...
> 	Any help will be very appreciated.
>
> Kind Regards.
>
> Pablo Jejcic
> *******************************************
> A man's wife has more power over him than the state has. - Ralph Waldo
> Emerson
> *******************************************


I had a battle with this one!

This is what you need to do.



Turning Directory Browsing off for a single virtual site using .htaccess -
HOWTO
----------------------------------------------------------------------------
----

create a .htaccess file for the virtual site you want to turn this off for.
Which looks like this (or add this to the existing one).

#Access file
Options -Indexes

Put it in the root of the site you want to protect, all sub directories will
use this .htaccess file UNLESS there is another one somewhere above it in
the tree (between the sub-dir and the root-dir).

In httpd.conf

Find the AllowOverrides line and set it to

AllowOverrides None

In the /etc/httpd/conf/access.conf file add the following at the bottom

<Directory /homes/sites/sitex/web>        ----- where sitex is the site
number for the virtual site
AllowOverides All
</Directory>

Make sure the following line is in /etc/httpd/conf/srm.conf

# AccessFileName: The name of the file to look for in each directory
# for access control information.

AccessFileName .htaccess

Restart httpd
/etc/rc.d/init.d/httpd restart

And you are done!!

Directory Browsing is now turned off for that client.


The usual things apply, back up your files first etc etc - oh and don't
blame me if you screw up your server ;-).


Paul.