Working with multiple domains on a single WordPress installation is technically possible — but without the correct setup, it creates serious SEO issues.
In one of our recent projects, the client needed two separate domains to be indexed by different search engines while sharing the same WordPress backend. This task revealed several architectural pitfalls that can cause indexing failures, duplicate content, and loss of visibility.
Below is the solution we implemented a safe, scalable, and search-friendly approach.
The Challenge
When two domains point to the same WordPress installation, search engines interpret them as duplicates. This leads to:
- accidental “mirror” recognition
- wrong canonical signals
- mixed-domain XML sitemaps
- index loss
- unstable search visibility
To avoid this, each domain must behave as an independent SEO entity — while still sharing the same CMS.
Step-by-Step Solution
1. Make WordPress Domain-Aware
Add the following lines to wp-config.php:
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] );
define( 'WP_SITEURL','https://' . $_SERVER['HTTP_HOST'] );wp-config.php:
This forces WordPress to generate domain-specific URLs, preventing cross-domain conflicts.
2. Generate a Separate XML Sitemap for Each Domain
After the previous step, your SEO plugin (e.g., Rank Math) will automatically produce:
domainA.com/sitemap_index.xml
domainB.com/sitemap_index.xml
Each sitemap must contain URLs only from its respective domain.
3. Create Separate robots.txt Files
Since WordPress supports only one robots.txt, we override it via .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domainA\.com$ [NC]
RewriteRule ^robots\.txt$ robots-a.txt [L]
RewriteCond %{HTTP_HOST} ^domainB\.com$ [NC]
RewriteRule ^robots\.txt$ robots-b.txt [L]
And create two static robots files with domain-specific sitemap references.
4. Confirm Correct Canonical Tags
Each domain should produce self-referencing canonical URLs.
WordPress handles this automatically once WP_HOME and WP_SITEURL are configured correctly.
5. Notify Search Engines (Optional)
To accelerate reindexing, submit each sitemap to its corresponding search engine:
- Google Search Console → Domain A
- Yandex Webmaster → Domain B
This ensures clean separation and faster index updates.
Result
With this configuration:
- both domains maintain independent search identities
- indexing stabilizes
- duplicate content signals disappear
- sitemap structure becomes clean
- canonical tags remain correct
- SEO performance improves across markets
Need help with technical WordPress SEO or multi-domain architecture?
Portnov Agency specializes in solving complex indexing issues, domain separation, SEO architecture, and high-performance WordPress setups.
We’ll ensure your project is built correctly from the foundation up.
