I have a top level virtual server example.com
Everything works fine for that domain.
I have a virtual sub-server on the same account
example2.com - Note it is not a subdomain
If I don’t have any files in example2.com’s public_html folder, references to http://example2.com/ return the index file for example.com THat’s pretty strange.
If I put a file hello.html in example2.com’s public_html folder then http://example2.com/hello.html is returned ok. But http://example2.com/ still returns example.com index file.
As long as I have an index.html (or index.php) in example2.com’s public_html folder I’m ok. It shouldn’t be required but I can live with that.
Now I have a further problem. In example.com I renamed a few pages and added rules in .htaccess to redirect old links to the new pages.
So I have, for example
Redirect permanent /contact/ http://example.com/contact-us/
in the .htaccess file in example.com’s public_html folder
That works fine: http://example.com/contact/ is redirected to http://example.com/contact-us/
But references to http://example2.com/contact/ are also redirected to http://example.com/contact-us/
and worse
http://example2.com/contact/some-other-name are redirected to http://example.com/contact-us/some-other-name
In this case the log files for example.com have entries for this request, and those for example2.com do not.
What is going on? Why is Apache even referencing .htaccess in the documentroot of example.com for requests with the domain example2.com.
I am very well versed in running servers, I worked with apache since 1.1 days. I can see no reason for this happening. The virtualhosts files for both domains are perfectly fine. I can’t find a debug option for apache which will show me how it is processing .htaccess files. Plus this is a production server so I don’t want to turn too much debugging on if I can help it.
Any help will be appreciated.
Edit: If I remove the .htaccess rules from example.com, it still happens, even after restarting apache. In fact in the small hours I restarted the server after an OS update and it still happens.