In this article, we will describe the problem with mixed domains on the Google search results when using Apache multiple virtual hosts configuration. We will showcase a real-life example of this situation, that we actually faced with our domains lately.
2. Domains configuration
To present the problem in a simplified form lets assume we have two domains configured on one IP address: domain1.com and domain2.com.
The index.html page for those domains have the following titles (this will be important to show how messed up search results were):
- Domain1 Home Page - Domain1
- Domain2 Home Page - Domain2
Initially, domains are configured as virtual hosts on one server (one IP address) using Apache, so we have two files:
with the following configuration:
When all domains are configured to serve data with HTTP protocol ONLY, we DON'T HAVE ANY ISSUES. Everything is working fine, and search engines are correctly indexing content of those domains and treat them as separate sites.
The situation changes when we try to add security configuration (HTTPS) JUST FOR ONE domain. In our case domain domain1.com will get additional SSL configuration:
3. Mixed search engine results
When only one domain (domain1.com) is configured to establish SSL connections it doesn't mean we can't request another domain (domain2.com) using HTTPS protocol. In fact, https://domain2.com will give the 'Connection is not private' result in the browser, not 404 Page not found error.
The Advanced section contains information about certificate generated not for domain2.com but for domain1.com. This is probably the reason search engines gets totally lost and we will get very strange searching results, like:
4. Cleaning the mess
We don't have to explain anyone that this strange situation will have a huge impact on the SEO of your websites. So how to get rid of this problem fast? The solution is simple. When we use virtual hosts and want to set up a security protocol for one domain, others should also have SSL connection established.
In our case we need to add SSL configuration also for domain2.com:
And thats it, after few weeks search results should back to normal.
This article presents a strange situation of mixing results by Google from two different domains when using multiple virtual hosts on one server, with one dedicated IP address. Fortunately, this situation is manageable, we must remember that when we want to set up a SSL connection for one domain others also need to have a secure configuration set up.