I have an Apache 2.2 VirtualHost where
DocumentRoot points to
I also have
Alias to make some pages/scripts located in
/var/www/stuff easily available (to others VirtualHosts):
<VirtualHost *:80> DocumentRoot /var/www/mysite.com ServerName www.mysite.com <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/mysite.com/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> Alias /stuff /var/www/stuff </VirtualHost>
DocumentRoot directory contains a
.htaccess file (
/var/www/mysite.com/.htaccess) that blocks unauthenticated accesses:
AuthType Basic AuthName "Please say the word..." AuthBasicProvider file AuthUserFile /var/www/mysite.com/.htpasswd AuthGroupFile /dev/null Require valide-user
When I try to access http://www.mysite.com, I get the HTTP authentication form. When I try to access http://www.mysite.com/stuff, I don't get the HTTP authentication form: files are freely accessible.
It seems the
/var/www/mysite.com/.htaccess is skipped when accessing http://www.mysite.com/stuff because files are in
/var/www/stuff id. not under
/var/www/mysite.com/.htaccess's parent directory.
The only workaround I've found is to create a
/var/www/stuff/.htaccess symlink to
user@server:~$ ln -s /var/www/default/.htaccess /var/www/stuff/.htaccess
Is there any better/cleaner solution?