I have many virtual hosts setup in my httpd.conf all set up like this:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "c:/wamp/wwwWP/"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName testing.local
DocumentRoot "c:/wamp/wwwtesting/"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName images开发者_如何转开发.local
DocumentRoot "c:/wamp/wwwimages/"
</VirtualHost>
I have commented out the #DocumentRoot line from the file. Everything works fine in my setup, but I can't figure out how to use a .htaccess file on more than one of my virtual hosts at the same time. I seem to have to change this line to the site I'm currently working on each time:
<Directory "C:/wamp/wwwimages/">
It's getting a little obnoxious. How can I set up my apache to use a .htaccess file for any virtual host that has one?
Thanks!
Check this SF question:
- https://serverfault.com/questions/203550/htaccess-is-ignored-even-though-virtualhost-has-allowoverride-all
Something along these lines should help:
<VirtualHost *>
ServerName intranet
DocumentRoot /var/www/default
<Directory "/var/www/default">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Also check this post:
- https://serverfault.com/questions/173910/in-apache-does-the-htaccess-file-override-the-httpd-conf-for-mod-rewrites
<VirtualHost 127.0.0.1>
VirtualDocumentRoot c:/wamp/www%-2
</VirtualHost>
精彩评论