Maybe domain mapping? Is this possible? (WordPress Software)

Shawn Gossman

Tazmanian Master
Joined
Dec 16, 2005
Messages
8,034
Okay, for the sake of not spamming, I'm using "fake domain names" here.

So let's say my main site (that uses wordpress.org software) is www.domain.com. I want to somehow "integrate" the additional domain www.second-domain.com into my wordpress software. I am working on a HUGE feature on my main site and want to basically give it its own domain if possible but still manage it from my main domain, again, if possible.

If it is too much of a challenge, let me know, I'll just have two different domains if I must.

Any ideas/suggestions would be awesome :)
 

mysiteguy

Migration Expert
Joined
Feb 20, 2007
Messages
3,080
I've done something similar before with multi-site. The gotcha there is from a content point of view its really not much different than multiple WordPress installs. The benefit, however, is you can do updates, maintenance, etc. for multiple sites only once instead of for each site.

A third way, is a single site WordPress installation with a little bit of trickery in wp-config.php. Normally the domain is setup in WordPress's settings, but you can use wp-config.php to override this. By having the domain name inserted dynamically into wp-config.php, it can handle more than one domain. Put this in your wp-config.php file:

Code:
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
Whatever domain the user is coming in through, WordPress will now work with it. There is an issue with this approach,
WordPress on both installations will want to display the same home page. But there's a workaround for this too, using .htaccess.

For domain 1, use the home page settings as you normally would.
For domain 2, create another home page, and for instance, give it a URL slug of homepage2.


Code:
RewriteCond %{HTTP_HOST} ^host2\.domain\.com
RewriteRule ^(/?index\.php$|/?$) homepage2
This will internally redirect (without an external 301 redirect to the browser) the home page of host2.domain.com to your homepage2 url.

I haven't tested out the particular code above, its been a while since I did something similar, but it should work (worst case a couple of minor tweaks). If you need help just post details here and I'll supply tweaks as needed.
 
Top