subdomain redirection problem with virtualhost
I have two domain names, domain1.tld, and domain2.tld. In DNS, both have A records pointing to the same ip address, 188.8.131.52. www.domain1.tld and www.domain2.tld are CNAME aliases for their respective domains.
My httpd.conf has the following:
when i visit www.domain1.tld, everything is fine. However, when I visit www.domain2.tld, it is redirected to domain2.tld instead of maintaining the 'www' portion. What could be causing this?
My first thought is that the ServerName for domain2 is "domain2.tld" and not "www.domain2.tld". In other words, you're *telling* the server that the name of the virtual host does not have a host name. Although, depending on what the rest of your httpd.conf, other configuration files, and servered pages contain - you may also want to look at what other directives are being given to the server (e.g. mod_rewrite). Oh, and take a look at the docs regarding AllowOverride - setting it to "All" could give you some headaches if you're not the only one with write permissions to that documentRoot.
When I change the ServerName of domain2.tld to www.domain2.tld, it just redirects to www.domain1.tld, like the request isn't being "caught" by Apache. I would change the DNS records, but it works fine for domain1.tld, so I don't see what the difference should be?
And yes, each virtual host has it's own user. :-)
I have mod_rewrite on, which changes domain1.tld to www.domain1.tld, and I have the same code for domain2. However, the problem pervades with and without the rewrite from domain2.tld to www.domain2.tld; either way, I keep getting domain2.tld.
Any other thoughts?
|All times are GMT -5. The time now is 11:25 AM.|