Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
I take it that you're not aware that aliases only apply to requested files, not Apache-internal files? –  womble Nov 16 '09 at 15:00
    
I am now, this is all kinda new to me. Trying to learn as I go. –  icelizard Nov 16 '09 at 15:01

1 Answer 1

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.

share|improve this answer
    
AccessFileName is precisely what he needs :) –  Nerdling Nov 16 '09 at 17:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.