Question

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.

Was it helpful?

Solution

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');

OTHER TIPS

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

https://wordpress.org/plugins/multiple-domain/

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top