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

Svetlana
6 Jan 20262 min

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.

Share this post
Svetlana
6 Jan 20262 min
Related articles

Thoughts on WordPress stability, support, and long-term maintenance

Read our latest articles, resources, and guides

Let’s make your
website stable again

Not sure what you need yet? Send us a short message 
and we’ll help you understand your website first.