I have come across a need of mapping multiple domains 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 top plugins for wordpress multisite but not for my need!
There are multiple ways to achieve mapping multiple domains 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.mobiinto 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
1 2 3 4 5 |
/* * 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 page 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
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!