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

Discussion in 'Blogs, Wikis, and other CMP's' started by Shawn Gossman, Oct 17, 2018.

  1. Shawn Gossman

    Shawn Gossman Tazmanian Master

    8,077
    1,222
    +1,923
    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 :)
     
  2. BrandonSheley

    BrandonSheley loving life

    2,676
    1,072
    +936
    Have you looked into creating a wordpress multisite?
     
  3. mysiteguy

    mysiteguy Devotee

    2,587
    887
    +1,833
    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.
     
    • Informative! Informative! x 4
    • Like Like x 1
    • List
Verification:
Draft saved Draft deleted
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.