Domain Mapping

Nadejda

Nadejda Milanova · 20th April 2021·Hosting

Domain Mapping

Are you looking for ways to put multiple domains to one WP installation? Do you want the chance to be able to display unique content for each domain and manage it from one website?

Your solution is domain mapping!

It can be used in a lot of ways to help you achieve your goals, which is why today we will show you how to map multiple domains in WordPress and how to use it to your advantage.

What exactly is Domain Mapping?

This is the process of directing traffic within one WP installation for multiple domains.

Why do you need Domain Mapping?

There are a number of reasons you might be interested in having multiple domains in one website. Some of them can include:

  • Creating your own custom page with its separate domain in order to target certain audience for service or product.
  • Creating pages on your website for each country or language with a different domain, without the need of a translation plugin.
  • WaaS or SaaA products which provide users with the chance to give their own domains or URLs.
  • Multisite network with multisite capabilities.

How does it work?

Let’s say you have two domains. They can be directed to the same website, so that you can manage content for each domain within the WP install.

Each domain can show you a certain page, post, or a sub-site altogether.

This way you can organize your website into different “sections” based on each domain.

Domain Mapping

In this example, domain2 and domain3 are the mapped domains. The website will display content from the specific landing and product page assigned to each domain.

There is a difference compared to the multisite network, which has a structure such as this:

multisite network

In both cases of domain mapping and multisite network, the URL bar shows domain2.com and domain3.com so that users are visiting a different domain with the same core WP install.

Note, that domain mapping does not work out of the box with WP. Each WP installation is set up for one domain and needs to be properly configured in order to handle multiple domains being pointed to it.

Preparations for Domain Mapping

There are some things you need to take into account before you start the process of domain mapping on your website.

Buy a domain/configure subdomain

The first thing you need to do is to buy your primary domain and subdomains. This a prefix to your primary domain. Domain mapping can be done with primary domains and subdomains, depending in which solution you decide to choose – see below.

DNS Records + Configuring Name Server

It’s crucial that you properly configure Name Server and DNS Records for all main domains and subdomains which will be included in the mapping process.

Configurating your Server

You would need to make some changes to your server so that it can handle domain Aliases in cases of secondary domain, or subdomains.

By using your cPanel, go to these apps so that you can configure the domains:

Configurating your Server

Setting up your website

The last thing is setting up your website so that it can handle the domains mapped. In this case you need to configure your WP code configuration or install a useful plugin.

Different ways for Domain Mapping

There are a few methods available which you can use for domain mapping:

WP Multisite Network

The downside to this method is that it can be complex to set up and difficult to manage. It involves configurating your website so that it can handle multiple domains and subdomains for each website on your network.

After completing the setup process, you can then switch between websites on the Network tab from your dashboard.

WP Multisite Network

With the help of multisite networks, you will get multiple WP websites with different domains and subdomains, while also allowing you to manage them separately.

The difficulty arises with themes and plugins, the limits of licensing for multiple sites and other type of limitations by multisite networks.

For example, if you have purchased a premium plugin with features for your website, in most cases those same features cannot be used for the multisite network, as usually plugins require a license for each website.

In the cases when themes and plugins are able to function across the entire network, you need to customize the settings individually so that they are properly configured.

WP Plugins

This method is very easy to set up and manage. Using a plugin, such as the Domain Mapping System, helps you to easily manage the mapped domain and point them to certain page, posts, products, etc.

The plugin lets you manage multiple domains in one WP site without the need to switch between websites.

Step 1: Choose the available post types for Domain Mapping

After properly configurating the DNS Records and server, install and activate the plugin, as well as the post types you want the map domains to:

WP Plugins

Step 2: Enter the domain you wish to map

Enter the desired domain in the field, choose the page, post, product, or custom post type you wish to appear for that specific domain:

Enter the domain

Now, open the domain in your browser, where you should be able to see the URL bar with the mapped domain.

Custom Coding

Another method is by coding your own domain mapping solution, which note, can be difficult to set up and manage on your own.

You can do any custom solutions to your domain mapping as long as you have the skills for it.

Every server environment is different, so take some things into consideration:

  • NGINX/Apache need server-side customization for each domain or subdomain which is being set up.
  • NGINX/Apache communicate with your website using WP REST API, so that it can establish the proper domain mapping for each post type.
  • You will most likely have to make changes to the .htaccess, wp-config.php and the page template files.

Conclusion

Domain mapping is not easy, but with the proper tools you can get started on your own. Depending in which method you choose, it’s simply a matter of finding what works for you best.