最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Can you run wordpress with multiple domains at the same time (not multisite)?

programmeradmin2浏览0评论

Every now and then some clients have multiple domains for the same site. For example domain and domain. 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 to domain 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.

Every now and then some clients have multiple domains for the same site. For example domain and domain. 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 to domain 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.

Share Improve this question edited Feb 11, 2015 at 4:25 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Feb 10, 2015 at 17:50 gdanielgdaniel 3,2915 gold badges29 silver badges48 bronze badges 1
  • 5 What you're asking about is called domain mapping, where a site has many alias' e.g. tomjn tomjn.co.uk tomjn 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
Add a comment  | 

3 Answers 3

Reset to default 25

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

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

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

I think there is a purpose to this question as it's something I'm working on right now. The OP's question just needs cleaning up a bit.

The purpose of having two domain names for the same site is routing.

Domain name #1 mydomain (or whatever) resolves to a local address ie 10.4.0.2 Domain name #2 mydomain resolves to a publicly addressable name

Clearly this is to speed up the development process and the upload of large files as it runs over LAN and doesn't take up any internet bandwidth.

Obviously we don't want wordpress adding the extension or whatever url we're arriving at the site through, to any posts that will be indexed by a search engine but for expedient routing during development this is a function that really would be useful

发布评论

评论列表(0)

  1. 暂无评论