I'm having problems sorting out the Domain Mapping plugin.

I'm having problems sorting out the Domain Mapping plugin. I've created a new subsite in WordPress multisite - test01.myprimarysite.com.

How do I get test01.myprimarysite.com to map to differentdomain.com?

I have complete access to DNS settings at the registrar (NameCheap). I'm currently using AWS Route 53 for DNS management and an AWS VPC for hosting. Nameserver management at NameCheap points to my DNS records at Route 53. Route 53 handles DNS for the new domain (differentdomain.com) as well as my WordPress multisite (primarysite.com) hosted on the AWS VPC.

Do I use a CNAME on Route 53 in the DNS record for the domain name (differentdomain.com)?
Or do I use a CNAME on Route 53 in the DNS record for my WordPress multisite (myprimarysite.com)?

Or do I need to do this all in cPanel of the WordPress multisite? The subdomains section of cPanel currently has one wildcard subdomain "*.myprimarysite.com".

Thanks.

  • Adam Czajczyk

    Hello Greg,

    I hope you're well today and thank you for your question!

    The first step is to make sure that the main domain is setup to handle wild-card sub-domains. I assume that this is already set up and that the "test01.myprimarysite.com" sub-site is up and running and available to visitors.

    Next step is to install and configure Domain Mapping plugin as described here:
    https://premium.wpmudev.org/project/domain-mapping/#product-usage

    Make sure please that the "sunrise.php" file (as mentioned in docs) is actually moved (not copied)!

    Once this is done, you will want to configure your "domain to be mapped" to load your main site. This can be done two ways:

    1. If you're using a dedicated (fixed) IP, you can set A record for the "domain to be mapped" on your Route 53 to be the same as an A record IP for your main domain and then make sure that the "root folder" for your IP is set to point to the main folder of your WP installation

    2. If you're going to use CNAME setup, setup CNAME on your Route 53 to point to your main domain.

    As a result both main domain and "domain to be mapped" should load your main site. From there, the Domain Mapping plugin will handle the rest, you will only add the "domain to be mapped" to the "test01.myprimarydomain.com" site via "Domain Mapping" settings.

    I hope that helps and in case you'd need any further assistance on this, let me know please.

    Best regards,
    Adam

  • Greg

    Thanks for the response. My problem is the final step. Can you be more specific?

    On which domain do I create the CNAME record? The primary domain or the domain to be mapped?

    I want to do this:
    differentdomain.com ---points to---> test01.primarydomain.com

    My DNS has an A record for:
    test01.primarydomain.com --> IP address of primary domain

    Where do I tell differentdomain.com to point to test01.primarydomain.com?

  • Greg

    I got a workaround solution from AWS:

    1. create an S3 bucket with the name of the domain to be mapped "differentdomain.com"
    2. in bucket properties, select 'static website hosting'
    3. select redirect all requests to another host name
    4. type multisite subdomain, "test01.myprimarysite.com" - save
    5. select permissions, create a bucket policy - save
    6. DNS settings for "differentdomain.com":
    7. go to previous A record, change it to an alias
    8. select S3 bucket endpoint as alias target - save record set

    Test in browser: http://"differntdomain.com" opens http://"test01.primarysite.com"
    Redirection now works. Waiting to see if the Domain Mapping plugin can clean up the URL. So far it's still saying the domain is unable to access the new domain. I'll update this after 12 hours.

    This was all to prevent having to create subdomains in cPanel. Just wanted to avoid making additional folders, FTP accounts, etc. If the AWS bucket method doesn't play well with Domain Mapping plugin, I will try subdomains in cPanel.

    Thanks.

  • Adam Czajczyk

    Hello Greg,

    Thank you for your response!

    As for S3 bucket method. I must admit I'm not that familiar with their tools. Let me know please if this worked for you and if it didn't we'll work on it further. One note however: the "differentdomain.com" (the domain to be mapped) should load the "primarysite.com" and not the "test01.primarysite.com". Before adding mapping all additional domains (domains to be mapped) should load the main site of your install.

    As for "domain not available". If this doesn't change in a reasonable period of time, you may want to go to "Network Admin -> Settings -> Domain Mapping" page and disable domain health/domain verification options. On some server configs this may be causing "false" issues.

    Best regards,
    Adam

  • Greg

    Ah hah! Pointing to the incorrect location is my first mistake.
    I already had an A record pointing the "differentdomain.com" (domain to be mapped) to the IP of the primarysite.com. I just tried creating a CNAME record based on the new information you just gave me. Also created a subdomain forward.

    [differentdomain.com 300 IN A 12.3.45.678]
    [*.differentdomain.com. 300 IN CNAME primarysite.com]
    [test.differentdomain.com. 300 IN CNAME primarysite.com]

    With the DNS change, the site goes to a cPanel error page. Are my above example that the correct CNAME record for redirecting the domain?

    Thanks for this!

    EDIT: cleaned up DNS formatting

  • Adam Czajczyk

    Hello Greg!

    Hopefully, we're getting closer to this.

    You wish the domain mapping to be this way:

    differentdomain.com -> test01.primarysite.com

    so if you type "differentdomain.com" into your browser address bar the "test01.primarysite.com" content is loaded under "differentdomain.com". Is that correct?

    Assuming that the "12.3.45.678" is an IP of your primarysite.com domain and
    - this is dedicated IP (static/fixed = doesn't get changed periodically)
    - is not shared with any other domain

    then you only need this record:

    [differentdomain.com 300 IN A 12.3.45.678]

    Wild-card ("*") and other CNAMEs are not required here and I think they may be causing troubles.

    You also need to make sure that:

    - the "12.3.45.678" IP's root folder is set to be the the same as root folder of "primarysite.com" domain.
    - the "differentdomain.com" is not set to use it's own directory that's different than a root folder of "primarysite.com"; it has to have no folder at all or point to the same one as "primarysite.com".

    As a result putting "primarysite.com", "differentdomain.com" or a "12.3.45.678" should all load the same site: your main site which is "primarysite.com".

    If this works, you'll be able to map "differentdomain.com" to "test01.primarysite.com" and Domain Mapping will work as well.

    Best regards,
    Adam

  • Greg

    Thanks for all the help. Adam was correct. I dumped the AWS approach and ended up using the cPanel subdomain approach:

    * pointed DNS to A record of primarysite.com - Thanks for all the help. I dumped the AWS approach and ended up using the cPanel subdomain approach: [differentdomain.com 300 IN A 12.3.45.678]
    * pointed DNS to A record of "primarysite.com""
    * in cPanel, created add-on domain
    * made "public_html" the home directory (opted for no FTP account)
    * log into sub-account in WordPress
    * in WordPress account, Tools/Domain Mapping, added "differentdomain.com" validated immediately.
    * typing "differentdomain.com" immediately opens the page that used to be "test01.myprimarysite.com"

    I was too focused on avoiding the add-on domain in cPanel to realize it's the best and easiest option.

    Thanks again for everyone's help.
    * created add-on domain
    * made public_html the home directory (opted for no FTP account)
    * log into sub-account in WordPress
    * in WordPress account, Tools/Domain Mapping, added "differentdomain.com" validated immediately.
    * typing "differentdomain.com" immediately opens the page that used to be "test01.myprimarysite.com"

    I was too focused on avoiding the add-on domain in cPanel to realize that method is the best and easiest option.

    Thanks again for everyone's help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.