I have a muluitple vhosts set up all with the same DocumentRoot pointing to a common set of files, I have set up AliasMatch for for the bespoke files on each site, I was wondering if I can have a .htaccess file for each vhost.
#Sample vhost
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName mytest.com
ServerAlias www.mytest.com
DocumentRoot /home/commonfiles/public_html
......
AliasMatch /css/(.*) /home/ftpuser/public_html/mycss/$1
</VirtualHost>
#Sample vhost 2
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName mytest2.com
ServerAlias www.mytest2.com
DocumentRoot /home/commonfiles/public_html
......
AliasMatch /css/(.*) /home/ftpuser2/public_html/mycss/$1
</VirtualHost>
I have added in an AliasMatch for the .htaccess but that didn't work.
#vhost 1
AliasMatch /.htaccess /home/ftpuser/public_html/.htaccess
#vhost 2
AliasMatch /.htaccess /home/ftpuser2/public_html/.htaccess
Any suggestions?
Thanks in advance.
I doubt that's going to work, the override stuff is probably happening beforehand. I'm not 100% here without wading through documentation.
What I'd do though is look at the AccessFileName directive which can be specified per VirtualHost.
Specify a different AccessFileName in the two VirtualHosts and you should be good to go. Bear in mind, this will change the filename Apache looks for override directives for all sub-directories accessed via that VirtualHost also.