I have a two domains johny.com
and alice.com
and one webserver (apache) managing them. Web files are in /var/www/johny.com
and /var/www/alice.com
and are configured as two virtual hosts with proper ServerName
and DocumentRoot
. Now Alice wants to protect one of her files on the web from anyone seeing. She introduces a .htaccess
file with the following content
<Files "private.txt">
Require all denied
</Files>
and also adds following to the apache config for her virtual host
<Directory /var/www/alice.com>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
And nobody has access to alice.com/private.txt
. So far so good.
Now John decides to provide an alias for Alice's web by altering his vhost apache configuration with
Alias "/alice" "/var/www/alice.com"
and anyone can see Alice's web page on john.com/alice
. But anyone can also see the content of alice's private file.
alice.com/private.txt
gives 403 Forbidden.
john.com/alice/private.txt
shows the content of the file.
What is going on in here? Does AllowOverride
not propagate through Alias
directive? How should we fix that? Apache version is Apache/2.4.38 (Debian)
. Also putting gibberish into .htaccess
file gives 500 Internal Server Error only on alice.com
, not on john.com/alice
, so it seems like the .htaccess
is not considered over an alias at all.