OhhMuaOhhMua
  • Home
  • Hosting
    • Best Web Hosting
    • Free Web Hosting
    • VPS Hosting
  • WordPress
    • Solutions & Troubleshooting
    • Installation & Setup
    • Themes & Plugins
    • Security
  • Build PC
    • High-end Builds
    • Mid-range Builds
    • Entry-level Builds
  • Computer Tips
    • Gaming Errors & Solutions
    • PC Troubleshooting
    • Hardware Tips
    • Computer Hardware
  • Coupons & Deals
  • Tools
    • veo3 prompt generator
Reading: Guide to Using Multiple Domains for One WordPress Website
Notification Show More
OhhMuaOhhMua
  • Computer Tips
  • Hosting
  • WordPress
Search
  • Home
  • WordPress
    • Installation & Setup
    • Security
    • Solutions & Troubleshooting
    • Themes & Plugins
    • Troubleshooting
  • Hosting
    • Free Web Hosting
    • VPS Hosting
    • Best Web Hosting
  • Computer Tips
    • PC Troubleshooting
    • Gaming Errors & Solutions
    • Computer Hardware
  • Coupons & Deals
  • veo3 prompt generator
Follow US
Copyright © 2024 ohhmua. All rights reserved.
OhhMua > Blog > WordPress > Solutions & Troubleshooting > Guide to Using Multiple Domains for One WordPress Website
Solutions & Troubleshooting

Guide to Using Multiple Domains for One WordPress Website

Admin (Nghia Vo)
Last updated: September 16, 2024 4:28 pm
Admin (Nghia Vo)
Share
4 Min Read
Guide to Using Multiple Domains for One WordPress Website
Guide to Using Multiple Domains for One WordPress Website
SHARE
Contents
Redirect WP_SITEURL and WP_HOMESEO Setup to Avoid Ranking Loss on GoogleFix Font Errors When Running with Additional Domains

The issue is that you have a website with the domain name your-domain.com. However, due to certain requirements, you need to point multiple different domains to this one website, such as your-domain.com.au, your-domain.com.uk, etc. So, how do we point multiple domains to one website running on WordPress?

Guide to Using Multiple Domains for One WordPress Website
Guide to Using Multiple Domains for One WordPress Website

We need to address three issues:

  1. Parked domain (Aliases) on the hosting where the main site is running, ensuring they point to the correct directory of the main site (typically /public_html).
  2. Redirect WP_SITEURL and WP_HOME to the domain that the user is accessing.
  3. Set up SEO to avoid Google flagging multiple sites with duplicate content.

Redirect WP_SITEURL and WP_HOME

For example, when you add the parked domain (Aliases) your-domain.com.au to your-domain.com, by default, when accessing your-domain.com.au, the browser will automatically redirect to the main domain your-domain.com. Therefore, we need to add the following code to the wp-config.php file so that when users access any of the domains, it will stay on that domain, and the links to posts and pages will remain on the domain the user accessed.

Add the following code to the wp-config.php file:

// Multi Domain for a site
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);

Once you add this code, most of the work is done. You will now be able to access the parked domains (Aliases) without any issues.

However, there’s still one problem: when multiple domains point to the same website, it can negatively affect your SEO. Google may identify this as duplicate content, and you could lose your rankings in search results. Don’t worry, though; I have a solution for you.

SEO Setup to Avoid Ranking Loss on Google

If you are using the Yoast SEO plugin, add the following code to the functions.php file in your theme. This will redirect all canonical traffic to the main site and prevent Google from flagging duplicate content when using multiple parked domains (Aliases).

Add this code to the functions.php file:

// canonical - old domain to new domain
add_filter('wpseo_canonical', 'swpseo_canonical_domain_replace');
function swpseo_canonical_domain_replace($url){
    $domain = 'your-domain.com'; // Change this to your main site, for example, your-domain.com
    $parsed = parse_url(home_url());
    $current_site_domain = $parsed['host'];
    return str_replace($current_site_domain, $domain, $url);
}

If you are using the All in One SEO plugin, add the following code to functions.php:

// canonical - old domain to new domain
add_filter('aioseo_canonical_url', 'aioseo_canonical_domain_replace');
function aioseo_canonical_domain_replace($url){
    $domain = 'your-domain.com'; // Change this to your main site, for example, your-domain.com
    $parsed = parse_url(home_url());
    $current_site_domain = $parsed['host'];
    return str_replace($current_site_domain, $domain, $url);
}

Fix Font Errors When Running with Additional Domains

Once you’ve set up multiple domains to run on a single WordPress source, you might encounter issues with fonts not loading, such as icon fonts not displaying, as shown below:

Error:

“Access to Font at … from origin … has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin … is therefore not allowed access.”

Fix Font Errors When Running with Additional Domains
Fix Font Errors When Running with Additional Domains

To fix this issue, copy the following code into the .htaccess file:

<IfModule mod_headers.c>
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
    Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>
480520387 657957633334779 6814038772835954285 n
Admin (Nghia Vo)

Hi, I’m Nghia Vo: a computer hardware graduate, passionate PC hardware blogger, and entrepreneur with extensive hands-on experience building and upgrading computers for gaming, productivity, and business operations.

As the founder of Vonebuy.com, a verified ecommerce store under Vietnam’s Ministry of Industry and Trade, I combine my technical knowledge with real-world business applications to help users make confident decisions.

I specialize in no-nonsense guides on RAM overclocking, motherboard compatibility, SSD upgrades, and honest product reviews sharing everything I’ve tested and implemented for my customers and readers.

You Might Also Like

SEO in the Age of AI: How to Make Google Understand and Value Your Content

Cannot Fetch Sitemap in Google Search Console

Discovered – Currently Not Indexed in Google Search Console: What It Means & How to Fix It

Why 2 Backlinks per Article Might Be Killing Your SEO

What is Obsidian? Why Developers Love This Note-Taking App

TAGGED:Multiple Domains
Share This Article
Facebook Twitter Email Print
By Admin (Nghia Vo)
Follow:

Hi, I’m Nghia Vo: a computer hardware graduate, passionate PC hardware blogger, and entrepreneur with extensive hands-on experience building and upgrading computers for gaming, productivity, and business operations.

As the founder of Vonebuy.com, a verified ecommerce store under Vietnam's Ministry of Industry and Trade, I combine my technical knowledge with real-world business applications to help users make confident decisions. I specialize in no-nonsense guides on RAM overclocking, motherboard compatibility, SSD upgrades, and honest product reviews sharing everything I’ve tested and implemented for my customers and readers.
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Trending

What is Obsidian
Solutions & Troubleshooting

What is Obsidian? Why Developers Love This Note-Taking App

May 20, 2025
Top Free WordPress Plugins for Bloggers in 2025
Themes & Plugins

Top Free WordPress Plugins for Bloggers in 2025

May 3, 2025
Computer Tips

6 Tips to Boost Your Hard Drive Performance

July 28, 2023
Fixing hasMerchantReturnPolicy and shippingDetails error for WooCommerce
Solutions & Troubleshooting

Fixing hasMerchantReturnPolicy and shippingDetails error for WooCommerce

September 14, 2024
Want to Protect Your Website
Security

Want to Protect Your Website? Never Do These 6 Things!

May 23, 2025
6 PC Components to Avoid When Building Your PC in 2025
Hardware Tips

6 PC Components to Avoid When Building Your PC in 2025

July 30, 2025
Previous Next

You Might Also Like

Optimize WordPress
Solutions & Troubleshooting

Want Faster Load Times? Optimize WordPress This Way

Admin (Nghia Vo) Admin (Nghia Vo) May 16, 2025
My Google Discover traffic skyrocketed after I did these 10 things
Solutions & Troubleshooting

My Google Discover traffic skyrocketed after I did these 10 things

Admin (Nghia Vo) Admin (Nghia Vo) May 14, 2025
How to Add a Read More to Product Descriptions in WooCommerce
Solutions & Troubleshooting

How to Add a “Read More” and “Show Less” Button to Product Descriptions in WooCommerce

Admin (Nghia Vo) Admin (Nghia Vo) May 5, 2025
WordPress Covers Every Website Type
Solutions & Troubleshooting

Blog, E-Commerce, or Forum? WordPress Covers Every Website Type!

Admin (Nghia Vo) Admin (Nghia Vo) April 29, 2025
Optimized Pagination thumbnail
Solutions & Troubleshooting

How I Optimized Pagination and Skyrocketed Traffic

Admin (Nghia Vo) Admin (Nghia Vo) April 28, 2025
How to Pick the Ideal Blogging Platform for Your Needs
Solutions & Troubleshooting

How to Pick the Ideal Blogging Platform for Your Needs

Admin (Nghia Vo) Admin (Nghia Vo) April 1, 2025
Previous Next
newsletter featured

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

Follow US on Social Media

Facebook Youtube Steam Twitch Unity

Copyright © 2024 ohhmua. All rights reserved.

OhhMua

Information

  • About
  • Terms & Conditions
  • Privacy Policy
Welcome Back!

Sign in to your account

Lost your password?