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
- 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.