Welcome to WebmasterWorld Guest from 184.108.40.206 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
problem with virtual hosting .htacess being ignored neiljones
I have a server hosting a number of domains. Two of them require me to use url rewriting in a .htaccess file. Domain1 is working fine. To set up and check domain 2 I have copied some of domain1's files so I can be sure everything is identical.
However on domain2 the .htacess file seems to be beeing ignored.
Here is a sanitised chunk of the httpd.conf file
NameVirtualHost 220.127.116.11 <VirtualHost 18.104.22.168 > ServerAdmin email@example.com DocumentRoot /web/pathway/www.domain1.com/ ServerName domain1.com ErrorLog /var/log/domain1.com-error_log CustomLog /var/log/domain1.com-access_log common ErrorDocument 404 /404/index.html <Directory "/web/pathway/www.domain1.com"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All </Directory> Options Indexes FollowSymLinks ExecCGI Includes </VirtualHost> <VirtualHost 22.214.171.124 > ServerAdmin firstname.lastname@example.org DocumentRoot /web/pathway/www.domain2.com/ ServerName domain2.com ErrorLog /var/log/domain2.com-error_log CustomLog /var/log/domain2.com-access_log common ErrorDocument 404 /404/index.html <Directory "/web/pathway/www.domain2.com"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All </Directory> Options Indexes FollowSymLinks ExecCGI Includes </VirtualHost>
The VirtualDocumentRoot supports the domains that do not need url forwarding.
Interestingly when I comment it out Domain2 shows Domain1's content.
Can anyone tell me what is wrong?
When I talk about commenting out above #I am refereing to commenting out the VirtualDocumentRoot line.
I have however tried a further modification.
I commented out the Virtual host stuff for domain1.
This resulted in the .htaccess file working for Domain2!
I am still baffled.
This is not my strong suit, but it appears to me that you have two virtual hosts, both named 126.96.36.199. While this is permissible, you'll need to add ServerAliases if you want things to work correctly for 'www' subdomains of each domain. As it stands now, www.domain1.com and www.domain2.com either won't resolve, or will both resolve to the domain1.com virtualhost.
Hopefully, an expert will check in on this thread. In the meantime, see [
...] and [ httpd.apache.org ...] for more info. httpd.apache.org
Can't see if this one got fixed either, but I can Bump!
jdMorgan's response fixed the problem. Thanks very much for your help.
It is only now that I can answer.