The Ultimate Guide to Domain Mapping with WordPress and Multisite
The Ultimate Guide to Domain Mapping with WordPress and Multisite
Domain Mapping is a powerful thing. Not only does it allow you to attach your perfect domain to your site (as well as any misspellings and variations of your domain name), but you can also provide professional domain mapping services like Edublogs.org and WordPress.com
Cool, huh? (I can’t be the only one excited about this, right?)
In this tutorial, I’ll go through the ins and outs of attaching a domain or sub-domain to a self-hosted WordPress site – a.k.a. domain mapping – as well as how to affix multiple domains to one site, and adding domains to individual sites in a Multisite network.
After learning how to map your domains manually, you can also check out the domain mapping plugins list and the setup steps of our own Domain Mapping and Pro Sites plugins to provide professional domain mapping services to your network.
Before You Get Started
In order to follow this tutorial, you will need a domain name that either you’re sitting on or one you have just purchased and want to add to a new WordPress or Multisite network you haven’t created yet. If you have one domain – or several – that you’re ready to use, then you can get started right away.
If you already have an established network where you would like to change the URL to a new one, then we have a guide for that: Moving Multisite to a New Domain (Without Errors!).
If you would also like to attach an SSL certificate to your domain to help keep your site secure, we have an article about that, too: How to Use SSL and HTTPS with WordPress.
Once you have your domain ready with an optional SSL certificate installed, it’s time to configure your domain.
Setting Up Your Domain
If your domain name was purchased from a different registrar than the one where you get your site hosting, you need to edit your DNS Zones. This process is a bit different for each registrar so you may need to get in touch with them for specific instructions.
To successfully map your domain, there are three things you need to change:
- A (Host Record) – The host should be set to
localhost.yourdomain.com.in cPanel where yourdomain.com is your site’s URL. For some registrars, the host should be set to
@and in either case, it should point to a record with the IP address of your site’s hosting account. You can find this information by logging into cPanel.
- CNAME (Alias Record) – In cPanel, the host should be set to
yourdomain.comif your site’s URL. The record should point to
yourdomain.com, but with your own site’s URL. For some registrars, there should be two hosts, one set as
ftpand the other set as
www. They should both point to
- Nameservers – These addresses are given to you by your site hosting provider and they are used to bridge the gap between your domain and the IP address of your hosting account so visitors can reach your site.
You may need to change your DNS zones if:
- You already have a cPanel account set up for your domain, you may need to change the DNS zones explained above if your domain was also purchased somewhere other than where you get your hosting.
- You got your domain from the same company as your hosting and you already have a cPanel account set up for your domain, you may only need to change the A record, but it’s likely already set up correctly.
- Your domain was purchased outside your hosting company, but you haven’t set up a cPanel account for it yet, you only need to set the nameservers for now. Once you have set up your account, you can change the A record to reflect the IP address for your site.
- You bought your domain from the same place where you get your hosting account, but you haven’t set up a cPanel account for it yet, you’re ready to continue with this tutorial and you don’t need to change your DNS zones since they should already be automatically set up correctly.
Creating an Account in WHM
If you have a shared hosting account, you can skip down to the next section, but if you have a VPS or dedicated server, this part’s for you. It works for both single and Multisite installs of WordPress as well.
Log into the root of your web host management account. If you don’t remember how to access it, enter the IP address of the root of your server into your browser’s address bar, followed by :2086 or :2087 if you have an SSL certificate installed on your server.
Once you have logged in, navigate to Account Functions > Create a New Account. This is where you can create a new cPanel account for your new domain.
Start by entering your domain name, without http://www. in front. You should end up with something like yourdomain.com in the text field.
The domain name you include here is set to the main domain for your account once it’s created, though, you can add other domains later.
The username and password fields are ones you can create from scratch to use with your new cPanel account once it’s created. You can also click the Password Generator button if you can’t think of a good password to use since one is generated for you on click.
The email you enter is where important information about your account is sent. The emails you could receive are important such as notifications when your site is down, for example, so be sure to enter a valid email that you check fairly frequently.
Next up, either choose a package you already previously created or check the Select Options Manually box to reveal all the available options for your new account.
If you want the selections you make to be saved as a package to save time in the future when you create another account, you can check the Save Manual Settings as a Package box.
The next section involves choosing the quota of different aspects of your new cPanel account. You can choose the unlimited radio button to not set limits or select the radio button next to the text box and enter a number.
If you choose the unlimited option, keep in mind that your account won’t be truly unlimited. The resources you use still need to be within the limits of your hosting account.
Once you’re happy with the amounts you enter, you can choose some additional settings in the next section. Choose carefully, since you may need these options later and they can be a bit of a hassle to change later on.
On the other hand, there are options you may not ever need and can be dangerous to set up since they can break your site easily if you’re not sure how to use them.
In particular, Shell and CGI Access are the settings you need to tread with caution. If you’re not sure what they do, it’s best to leave these options unchecked.
If you select the Dedicated IP option, one is automatically assigned from your list of available addresses. If none are available, WHM returns an error message to let you know.
The drop down box next to cPanel Theme is where you can choose the design of cPanel you prefer, although, this can easily be changed later when you log in to your new account.
Locale is where you can select the default language option for your account in the drop down box.
For the Reseller Settings, if you don’t have a specific reason to enable them, it’s best to keep these options unchecked. On the other hand, you may need them for certain plugins and capabilities such as if you would like to sell hosting space on your server or for using our Multi-DB plugin.
The DNS Settings can be a bit tricky. You also need to make sure you have set up your domain with your nameservers as outlined above before continuing, otherwise it results in an error.
The DKIM (DomainKeys Identified Mail) and SPF (Sender Policy Framework) checkboxes are mechanisms designed to verify the sender of an email by checking that the email is valid. These two settings are helpful, but aren’t the only precautions you should take towards email safety.
Below the checkboxes, you should see the nameservers listed that are applied to your account unless you check the option Use the nameservers specified at the Domain’s Registrar.
This setting uses the nameservers that are currently set for your domain which may be different if your domain was purchased through a different company than the one you use for your site hosting.
If you already changed your nameservers to point to your hosting account, then you don’t have to worry about selecting this checkbox, but if you do, it won’t cause your site to stop working.
The Overwrite any existing DNS zones for the account setting deletes all the current DNS zone data stored for your domain on your server in case there’s some lingering from a time where you had the domain attached to an account, but deleted it.
Checking this box overwrites that data. You shouldn’t have to worry about checking this box unless you try to create an account and an error message displays letting you know that the account wasn’t created because of pre-existing DNS zones.
In most cases, you can select the radio button for Local Mail Exchanger for the Mail Routing Settings.
It enables you to send and receive mail within your own server and from external sources.
The Backup Mail Exchanger option can be set if you want your domain to accept mail as a backup when your main mail system fails. The Remote Mail Exchanger disables sending and receiving emails from your domain.
If you’re not sure which one to pick, you can select the Automatically Detect Configuration to choose the best option for you based on how your server is set up. If you make a mistake with this setting, you can correct it later in cPanel under Mail > MX Entry.
Now you’re ready to click the Create button at the bottom of the page to create your new cPanel account. If no errors are displayed, your cPanel account was successfully created and your main domain has been set up for your site.
Adding Additional Domains to cPanel
If you have a VPS or dedicated server and you have followed along so far in the tutorial, you’re all set adding your first domain. For shared hosting accounts, you should already have your first domain set up with your hosting account.
But what if you want to add more domains and direct them to your main site? These tips should do the trick.
You can buy the misspellings of your main domain to make sure visitors who make a common mistake can still get to your site or domains that include popular keywords for your business to help drive traffic even more.
Before you can affix a domain to a new site you create, you need to direct it to your hosting account. These instructions show you how to add additional domains to your cPanel account to use with your site no matter how your server is set up or whether you want to create a single or Multisite installation of WordPress.
Now, navigate to cPanel. To log into your account, you can either enter your domain name or site’s IP address, followed by the port like in the example below:
yourdomain.com with your actual domain and
111.222.333.444 with the actual IP address of your site. If you’re not sure what your site’s IP address is, ask your hosting provider.
Once you have logged into cPanel, navigate to the domains section and click the Addon Domains button.
Next, fill in the text fields to add another domain to your site.
Start by entering a domain name you own and that you would like to direct to your site.
The FTP username field automatically populates based on the domain you enter, but you can change it to whatever suits your needs.
The important part is the Document Root field.
You need to direct your domain to the correct file path for the site you want to use the domain. This option is automatically populated as well, but you can edit it.
To use your domain for the main site, edit down the Document Root field to the root of your account. This varies sometimes between hosting companies but generally looks like
www. Make sure not to include a forward slash at the end.
To use the domain for a different site in your hosting account, you need to know the folder name where the site is stored. If you’re not sure what the folder is named, you could access it by going to Files > File Manager in cPanel.
Once you start typing it in, it should appear below the text field like a drop down box. You can select the correct one from the list.
Next, enter a password or generate a strong one by clicking the Password Generator button. This helps increase the security of your domain so only those with the password can change the domain data.
Finally, click the Add Domain button to add the additional domain to your account, though, you might not be done yet. You still need to make sure the domain is pointed to the location of your site in your hosting account which is where we’re headed next.
Affixing Domains to Your WordPress site and Multisite
Once you have added all the additional domains you want into your cPanel account, it’s time to verify the domain is affixed to your hosting account.
You need to make sure the A and CNAME DNS records are set correctly along with the nameservers just as described earlier in this tutorial.
If your domain is registered with a different company than the one that supplies your hosting, you need to consult their documentation or contact them to find specific instructions of how to do ensure your domain is pointed to your hosting account since many registrars are different.
If your domain and hosting account are from the same place, you can verify the DNS records yourself. On the other hand, your domain’s nameservers can be found on the site where you got your hosting.
If you have a VPS or dedicated server and you have followed the tutorial so far, your nameservers should be already set up correctly at this point and you’re ready to verify your DNS records.
On the cPanel home page, go to Domains > Simple DNS Zone Editor. Select one of your domains in the drop down box to reveal the simplified DNS records.
Ensure that you have an A record that points to the IP address for your cPanel account. By default, you may see a record of
127.0.0.1 which is a standard IP address for local machines. Unfortunately, that’s not the A record you need.
Click the Delete button next to that record and confirm that you want to delete the record by clicking the Delete button that appears under the record that you chose to delete.
Scroll to the top of the page to the Add an A Record section. In the Name field, type in localhost and in the Address field, enter the IP address that your cPanel account uses. Finally, click the Add a Record button.
If you’re not sure what the IP address is for your cPanel account, go to the homepage and you should see it listed on the left.
You may need to click the Expand Stats link to see your account’s IP address if you don’t see it listed beside the label Shared IP Address or Dedicated IP Address.
By default, there should be an FTP CNAME set up correctly, but if not, you can enter FTP in the Name field and the domain name for your main site in the CNAME field under the section Add a CNAME Record on the Simple DNS Zone Editor page. Then, click the Add CNAME Record button.
Now you’re ready to create a single or Multisite installation of WordPress. If you’re not sure exactly how to do this, check out the Installing WordPress and the Famous 5-Minute Install pages in the WordPress Codex.
Directing Sub-domains to Your Main Site
Once you have added your domains to your cPanel account, you can add sub-domains for them that can be directed to your main site, other sites in your hosting account and sites in a network that use sub-directories.
If your domains are hosted separately from your site, you should consult your domain registrar for the instructions on how to create sub-domains since each registrar can differ. If your domain and site are hosted in the same place, you can create sub-domains in cPanel if you have it set up.
Go to the homepage of your cPanel account, then to the Domains section and click on the Subdomains button.
Enter your desired sub-domain in the first field, then select the domain you would like to use from the drop-down list next to it.
If you have a sub-domain installation of Multisite, enter an asterisk (*) into the sub-domain field to create what’s called a wildcard domain. Each time a site is created in your network, the sub-domain that’s entered can actually work and be visited successfully.
Then, enter the Document Root for your desired outcome.
To direct your sub-domain to:
- Your main site –Type the root of your account. It can differ depending on your hosting, but it’s typically
- A different site in your account – Type the folder path of the site in your account. For example,
- A site in your network – Type in the root path of your hosting account. For example,
public_html. You can redirect the sub-domain once it has been created.
- A wildcard domain for sub-domain installs of WordPress Multisite – Type in the root path of your hosting account. For example,
Once you have entered everything correctly, click the Create button. You should now see your new domain listed on the page.
If you would like to direct your new sub-domain to a site in your network, click the Manage Redirection button under the Actions column of the sub-domain list on the page.
On the page that loads, enter the URL of the site in your network.
Finally, click the Save button next to the redirection field. That’s all you need to do.
If you would simply like to add a sub-domain that directs to your main site as a supplement to the main domain you are using, you can do this by creating a CNAME record.
Go to Domains > Advanced DNS Zone Editor on the cPanel home page and begin by entering your main domain with a period at the end in the Name field toward the top of the page.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
Next, in the Time to Live (TTL) field, enter 14400 which is the standard value most need to enter. Select CNAME from the Type drop down box, then type the sub-domain you wish to map into the CNAME text box.
The sub-domain doesn’t have to be attached to your main domain but does need to be a part of a domain you own and have pointed to your hosting account and site.
Finally, click the Add Record button and you’re all set.
If you don’t see the Advanced DNS Zone Editor button listed on the cPanel home page, you need to add the functionality to your account through WHM for VPS and dedicated servers. If you’re on a shared hosting account, you need to contact your hosting provider and ask for them to give you access to this feature.
In WHM, go to Packages > Feature Manager.
In the Feature List Name text box, enter a name of the feature list you want to create. For example, “Advanced Features” or “Advanced DNS” for this specific feature. Then, click the Add button.
On the next page, you can check the boxes for all the features you would like to include as a part of the list. You can de-select all the options from the list that you don’t want to include, if any.
Make sure to keep the fourth item on the list checked for the Advanced DNS Zone Editor. When you’re done making your selections, click the Save button.
You can only select one feature list per package so be sure to check off all the options you want for your cPanel account instead of just one feature – unless you only need one.
When you get a message saying the list has been saved, click the Back to Feature Manager link.
Navigate back to the home page and go to Packages > Edit a Package. Select a package from the list and click the Edit button at the bottom.
If you don’t have any packages yet or want to make a new one, you can create one by going to Packages > Add Package.
Scroll down to the Feature List field and select the list you just created in the drop down box. Finally, click the Save Changes button at the bottom.
Make sure you log out of cPanel, then log in again. You should now see the Advanced DNS Zone Editor button in the Domains section.
Creating Temporary and Permanent URL Redirects
Creating URL redirects can be incredibly helpful for your site, especially when you create a new post that’s an updated version of an old one. You can permanently redirect the old one to automatically switch to the new post every time some tries to visit the outdated post.
You can easily create redirects in cPanel and also manually if you prefer that method.
To create a permanent or temporary redirect in cPanel, go to the Domains section of the homepage and click on the Redirects button.
Next, select the type of redirect you would like from the drop-down box, then select the domain you would like to redirect.
You can type a specific URL path next to the domain you select from the drop-down list if you want to redirect a specific page. You can leave it blank to redirect the entire domain.
In the Redirects to field, enter the full URL of the new page where you want the domain to redirect.
Next, select one of the radio buttons to determine whether certain types of URLs should be redirected:
- Only redirects with www.
- Redirect with or without www.
- Do not redirect www.
You can also click the Wildcard Redirect checkbox to redirect any sub-domains associated with the domain you selected.
Finally, click the Add button to create your redirect.
You can also create permanent (301) redirections manually in case you have your domain and site hosted separately.
Edit your .htaccess file to include a line at the very top that looks similar to this example:
To create your own redirect, replace
category/2015/02/01/this-is-a-post-title/ in the example with the path or URL of the page you want to redirect and also replace
http://your-new-domain.com/category/2015/02/01/this-is-a-post-title/ with the URL of the new page.
Also, be sure there is a single space in between the two links. Once you save your .htaccess file, the redirect should start working right away.
Domain Mapping Plugins
If you want an easy way to add domain mapping functionality to your WordPress site that doesn’t require mucking about in cPanel, you can certainly use plugins instead.
Here’s a list of reliable domain mapping plugins that are updated frequently for best results. While not all the plugins on the list are free, they are created with Multisite in mind so you don’t have to worry about compatibility issue with your network, although, it’s best to test these plugins with others you have installed to make sure they’re compatible.
It may be important to note that these plugins do require a bit of extra work when it comes to the installation process, but each of the plugins come with straight forward instructions so getting these plugins set up shouldn’t be too difficult.
With the Domain Mapping plugin, you can do two things: Map domains to any site in your network and sell it as a service with an eCommerce plugin like MarketPress.
You could also bundle it with Pro Sites to sell domain mapping as a service a part of a package where users can upgrade to use their own domain for their site.
You can even become a domain reseller and have your users purchase domains directly from you. You also have the option to force users to use an SSL certificate with their domain to help keep your network secure.
It’s a premium plugin, but it comes with premium features you won’t be able to find elsewhere.
It’s the one plugin to rule them all.
This plugin lets your network’s users map their own domains in a few simple steps. All your users need to do is point their domain to the IP address for your network.
You can also type in your IP address into the plugin to display to your users so they can set up their domain on their own and without needing your assistance.
It’s a solid free plugin that gets the job done.
Pronamic Domain Mapping is unique because it works with both single and Multisite installations of WordPress. You can even manage your domains within WordPress and set domains to point to individual pages with ease.
It’s a free plugin that’s straight forward to use and doesn’t require too much in the way of extra setup steps.
Using Pro Sites to Sell and Automate Domain Mapping
The Domain Mapping and Pro Sites plugins include the capability of helping you earn extra income and increase the functionality of your network by offering upgrades for premium features.
Pro Sites has many professional features such as:
- Ad-free blogs
- Bulk upgrades
- BuddyPress features
- Offer blogging as an upgrade
- Set Post and/or Page quotas
- Premium Plugins
- Premium Themes
- Premium Support
- Set upload quotas
- Offer free trials and coupons
- Handles refunds and cancelations
- Plus lots more
The Domain Mapping plugin includes premium features such as:
- Mapped domain manager
- End user domain mapping
- Unique landing page URLs
- Network cookie sharing
- Multiple mapped domains
- Cross-domain auto login
- DNS record verification
- Propagation check
- Force HTTP/HTTPS
- Integrated domain resale
- eNom and WHCMS integration
- And tons more
If the idea of selling domain mapping as a premium upgrade to your network sounds really good to you, then here are the steps to setting this up in your Multisite install.
Before You Get Started
It’s a good idea to backup your network before continuing since you’ll be making significant changes to your Multisite. If anything goes wrong, you can easily restore your site to its former glory.
If you would like more information on backing up and restoring your site, check out some of our other posts: How to Backup Your WordPress Website (and Multisite) Using Snapshot, 11 Best Free Quality Backup Plugins for Protecting Your WordPress site and 7 Top Premium and Freemium WordPress Backup Plugins Reviewed.
Once that’s out of the way, it’s time to install and activate the Domain Mapping and Pro Sites plugins. While Pro Sites is easy to install and we have a guide written out for you, the Domain Mapping plugin is a bit more involved and requires some extra love, although, it’s still a quick process.
In order to install the Domain Mapping plugin, you need:
- A Multisite install of WordPress
- A dedicated IP address
- FTP Access
- PHP version 5.3 or higher
You may find you can get away with not needing FTP access if you prefer transferring and editing files directly in your hosting setup, but for most users, FTP may be the way to go.
If you meet those requirements, you’re ready to install the Domain Mapping plugin.
Start by downloading the Domain Mapping plugin and unzipping the file. Upload the domain-mapping folder to wp-content > plugins in your network via FTP. You can find domain-mapping inside the first numbered folder.
In this folder, you should see a file called sunrise.php and once you find it, move it directly into the wp-content folder. If you copy the folder, it may result in errors so move the file entirely.
Next, edit the wp-config.php file located in the base of your WordPress files and include the following code:
Be sure to include it before the happy blogging line:
Head over to your super admin dashboard’s Plugins > Installed Plugins page, and network activate the Domain Mapping plugin. You’re all set up now.
Configuring the Domain Mapping Plugin
Now it’s time to set up your domain mapping service the way that works for your network. Go to Settings > Domain Mapping and configure the options.
If the plugin was able to detect your IP address, it will be displayed for you with a message letting you know everything looks ay-OK. Even if you don’t see your IP address displayed, enter it into the Server IP Address field.
If you would like to add custom instructions for your users, you can enter it into the next field, but it’s optional. If you leave it blank, the default info is displayed.
Next up, if you select the Allow site admins to set multiple mapped domains checkbox, your users won’t be limited to just one mapped domain.
You can also limit which domains your users can use to access the admin dashboard in the Administration mapping section.
You can limit access to the Multisite generated domain, the mapped domain or allow both.
Keep in mind that if you select the mapped domain option here and the domains your users map aren’t properly propagated or resolved, then the admin area becomes completely inaccessible.
When the domain is propagated and resolved, the admin area becomes accessible again, but if keeping the admin area accessible at all times for your users is important to you, then consider choosing a different option in this section.
The Login mapping section is similar, except it limits which domains users can use to log in.
The Cross-domain autologin option can let users type any mapped domain, log in and access the entire network and not just the mapped site for the domain they entered.
The Domain Mapping plugin has the capability of verifying the DNS records of an entered domain by checking it against the WHOIS records to make sure it works.
Similarly, you can also choose to let this plugin works its magic to verify the health of domain your user wishes to use in the Check domain propagation before mapping option.
If you have an SSL certificate installed for your network, you can force the use of HTTPS when site admins log in or access their dashboard.
Just be sure not to let your SSL certificate expire and don’t revoke it if you enable this option since it would make logging in impossible until you uninstall the plugin.
If you do find yourself locked out because of an invalid SSL certificate, you can resolve this issue by manually uninstalling the plugin. You can do this by renaming the domain-mapping plugin folder that you should be able to find under wp-content > plugins.
If you want to prevent users from mapping certain domains and using them as a primary domain, you can enter them into the multi-line text box in the next section called Prohibited mappings. Just be sure to separate them with a comma.
Below the text box, you should see a checkbox that can prevent the mapping of any sub-domains of the main domains you entered in the field above it.
The last setting on this tab enables you to choose whether admins in your network can adjust and set their own prohibited domains as well as pages and URLs to force the use of HTTP or HTTPS.
If you enable access to them, they won’t be able to override the settings for your network. They could only adjust the settings for their own site.
When you’re done making your selections, click the Save Changes button at the bottom of the page for your changes to take effect.
There is also the Reseller options tab with a couple settings to configure if you want to be a domain reseller in your network.
The first option, Select reseller API requests log level, lets you choose how to keep track of domains that users purchase from you.
Under the Reseller provider option, you need to choose which reseller provider you want to use. You can choose between none, eNom and WHCMS.
When you click the eNom or WHMCS radio buttons, a form dynamically appears for you to enter your account information or sign up for one if you don’t already have an account.
If you need more information on how to set up these accounts with your network, check out the installation guide for the Domain Mapping plugin.
When you’re done, don’t forget to click the Save Changes button one more time at the bottom of the page.
Now users can access options under Tools > Domain Mapping and add domains to their site independently.
Setting Pro Sites to Stun and Sell
If you want to sell domain mapping as a premium service in your network, you should find the Pro Sites plugin particularly useful for doing exactly that.
To set up your upgrade packages and payment gateways, check out our guides Adding Premium Upgrades to Your Multisite Network with Pro Sites and the plugin’s installation guide.
Once you have created your packages, go to Settings > Domain Mapping and scroll to the bottom of the page. There will be a new section called Select Pro Sites Levels.
Click on the checkboxes for the packages where you want to include the domain mapping feature, then click the Save Changes button.
That’s all there is to it. Now you know how to map your domain – and even multiple domains and sub-domains – to your self-hosted WordPress site or network. You also know how to set up a domain mapping service as a premium service in your Multisite network to help you earn extra income. Score!
For more ways to expand your WordPress and Multisite installs, check out some of our other posts: Building Fully Customized WordPress Front-End Login, Registration and Profiles Without Touching Code, How to Use One SSL Certificate for Your Entire Multisite Network and How to Set Up a Paywall on Your WordPress Site (and Why Your Should.)
Do you love domain mapping as much as I do? Do you think domain mapping is a great feature to add to your WordPress site or network? Let us know what you think in the comments below.