How to Configure Two Domains on One WordPress Website and Achieve Clean, Search-Friendly Indexing

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:

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:

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:

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.

ROI Metrics Worksheet

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

International WordPress Scaling Guide

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

Backup & Recovery Checklist

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

White Label Growth

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

Campaign Readiness Checklist

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

Monthly Health Check Template

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

Support vs Freelancer

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

7 Practical AI Integrations for WordPress

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

Elementor Build Checklist

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

Core Web Vitals Optimization Checklist

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.

Download WordPress Security Guide 2025: Checklist of Essential Steps

* We collect your name and email only to send you the requested checklist and related updates.
Your data will never be shared with third parties.
You can unsubscribe or request deletion of your data at any time, in line with GDPR and Portuguese data protection laws.