In this article, I will explain how to setup Domain-Mapping itself and then how to configure or map external domains in WordPress-Multisite.
Before you go ahead, you must have a WordPress Multisite Network created using subdomains or subdirectory.
WordPress Multisite Domain-Mapping Setup (one-time)
This is one-time activity only.
- Install WordPress MU Domain Mapping plugin. Activate it Network-wide.
- Add the following line in wp-config.php file. (
define( 'SUNRISE', 'on' );
sunrise.phpfrom Domain-mapping plugins folder to
wp-contentfolder of your WordPress setup.
cp /var/www/example.com/htdocs/wp-content/plugins/wordpress-mu-domain-mapping/sunrise.php /var/www/example.com/htdocs/wp-content/
- After this, go to
Network Admin >> Dashboard >> Settings >> Domain Mappingmenu.
- On next screen, either provide IP address of your server or a CNAME record which you want to use with other domains. Note: If you add both – an IP address and a CNAME record, only CNAME will work!
- Apart from this, you will notice few more settings: “Domain Options”. You can leave them as it is. I recommend enabling the “Permanent redirect” option.
IP-Address (A-record) v/s CNAME-records based Domain Mapping
If you are confused what to use, the following may help you make a choice:
- IP-address based domain mapping uses A-records. IP-Address based domain-mapping will be slightly faster as it saves 1 DNS look-ups. This advantage is not significant since most name-servers use caches.
- CNAME-records are easy to manage, if you will be hosting 100’s of sites on your network. If you change IP of your WordPress server, say change in hosting service, then you will need to make update IP address for your own CNAME record only. In other case, you need to update IP address for all A-records for all domains mapped to your server.
In both cases, your server must have a dedicated IP address. You can host other sites on same IP address but you cannot host 2 or more WordPress Multisite networks with domain mapping on same IP address.
Mapping External Domains to sites in WordPress-Multisite (ongoing)
You can create new sites as usual in your WordPress-Multisite network. You will need to follow these extra steps in case you wish to map one or more domains to network sites.
- Go to
Network Admin >> All Siteslist
- Click on edit link for a site for which you want to map external domain.
- If link is => http://example.com/wp-admin/network/site-info.php?id=5 ; your site-id => 5
- Go to
Network Admin >> Dashboard >> Settings >> Domains
- Look for
- Enter site-id and external-domain name.
At this point, you need to add a CNAME-record or A-record for external domain at your DNS registrar end. Since instructions for them vary from domain to domain its not possible to post all of them here! You can Google for help or contact your domain registrar! 🙂