Summary

I have come across a need of mapping multiple domain into single instance of WordPress installation for my blog “myjeeva.com” & “myjeeva.mobi”.  Then I did a search on the net, I found lot of references and plugins for single WordPress instance for multiple blog site within; take a look on ‘http://www.slideshare.net/AndreaRennick/top-plugins-for-wordpress-multisite‘, but not for my need!

There are multiple ways to achieve multiple domain into single wordpress installation (sharing everything except domain name).  I thought to create a blog post around these activities, perhaps it will benefit someone!


Approach Taken & Implemented

Below are the steps I followed for my blog.

  • Installed the WordPress into parent domain ‘myjeeva.com
  • Configured various plugins for my blog
  • Pointed second domain ‘myjeeva.mobi’ into parent domain IP through A record in DNS zone editor
  • Edited ‘wp-config.php‘ for two domain names according while accessing i.e. to reflect Site URL and Site Home to respectively

Editing wp-config.php

  • Go to WordPress installed root directory and look for wp-config.php file
  • Place below lines after the “table_prefix” line (order is very important in wp-config.php, more info)
/*
 * Handle multi domain into single instance of wordpress installation
 */
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
  • Go to wordpress admin and take a look at ‘Settings -> General‘. You will have ‘WordPress Address (URL) and Site Address (URL)‘ will be in disabled state.  It means your wordpress installation dynamic enoungh to accomadate both domain address.
Wordpress Admin -> Settings -> General

Wordpress Admin -> Settings -> General


Completion

That’s it, now your WordPress instance have been enabled with multiple domain address.  I have shared the approach and step I followed for my blog. Make use of it!
Tagged with →  
  • http://www.awkreativ.com Adam Wadsworth

    Absolutely spot on dude, thanks for this snippet just used on a clients website, Saved me so much hassle figuring this out myself.

  • ismael

    Thank you very much, that’s what I was looking for!!

  • Brent Wallace

    Hi. I plan to try this, I hope it works. Are you limited to only TWO (2) domain names? Or could you use three or more? Thank you!

    • http://myjeeva.com/ Jeevanandam M.

      @Brent Wallace – It’s possible to map more than one name dynamically. It’s not limited to two.

      Cheers,
      Jeeva