Every now and then some clients have multiple domains for the same site. For example domain.com and domain.org. Is it possible to have wordpress work with both domains at the same time? I typically see issues when trying to load resources because of Cross-domain access. I know that I could just point domain.com to domain.org in the domain settings, but I was wondering if that's the only way.

I searched for solutions here, but all questions are about how to setup multiple domains for multisites (which makes sense). Just to be clear, I am not running a multisite.

  • 5
    What you're asking about is called domain mapping, where a site has many alias' e.g. tomjn.com tomjn.co.uk tomjn.org all being the same website. However it would be simpler and more efficient to declare 1 domain canonical, and have the others redirect there, this simplifies login authentication and cookie setup, as well as issues with canonical locations of content and SEO
    – Tom J Nowell
    Commented Feb 10, 2015 at 18:08

2 Answers 2


Are you wanting for the exact same WordPress site to work on two different domain names, where all links and content would use either domain name?

If this were the case, you would run into Duplicate Content issues with Google, hurting your SEO pretty badly.

That being said, you still would have a very hard time getting WordPress to properly load your content off of either domain name. A variety of functionality uses the get_site_url function to construct the links on your pages, so all of your links would be using only the one domain within your Siteurl setting.

Even still, if you want to try and get really tricksy, you can use something like the following to define your Siteurl and Home in the wp-config.php based upon the Domain being passed to the site:

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress');
  • That's pretty much the answer I expected. Thank you.
    – gdaniel
    Commented Feb 10, 2015 at 18:48
  • 1
    does not work,, whatever i do if i browse to any domain added , i will get redirect to the original domain name
    – Zorox
    Commented Aug 29, 2016 at 17:58
  • Seems like this solution is no longer working. I tried the same but couldn't get it working. While it used to work with previous version of WP. Commented Aug 21, 2018 at 18:13
  • It is working for me on the latest WP version 5.6.1. Thank you so much.
    – Dipu Raj
    Commented Feb 19, 2021 at 11:13
  • 1
    Maybe this official guide can be used for what the OP is trying to do: wordpress.org/documentation/article/…
    – TCB13
    Commented May 17, 2023 at 9:40

Just check this WordPress Plugin it should resolve this issue easy way..


  • 3
    Can you offer an explanation as to why this plugin is a better solution that something custom built for this user's specific site. Just posting links isn't very helpful and isn't teaching anyone anything. Commented May 27, 2020 at 1:44
  • @TonyDjukic that plugin also replace URL in post content, media's URL. Changing WP_SITEURL and WP_HOME base on $_SERVER['HTTP_HOST'] will not do this.
    – ndlinh
    Commented Aug 20, 2020 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.