How To Add a Custom CNAME DNS Record

In my post on How To Speed Up Your Blog With a Content Delivery Network, I got a few people asking how I created the custom CNAME for my content delivery network. Before I show you, let’s review what a CNAME is. According to Wikipedia, a CNAME is the following:

A CNAME record or Canonical Name record is a type of resource record in the Domain Name System (DNS) that specifies that the domain name is an alias of another, canonical domain name. This helps when running multiple services (like an FTP and a webserver; each running on different ports) from a single IP address. Each service can then have its own entry in DNS (like ftp.example.com. and www.example.com.). Network administrators also use CNAMEs when running multiple HTTP servers on the same port, with different names, on the same physical host.

Doesn’t make a lot sense, does it? Let me make it easier. A CNAME is all about branding.

  • Instead of having my CDN at blog.johnchow.netdna-cdn.com, it’s cache.johnchow.com
  • Instead of having my mobile blog at johnchow.mobify.me, it’s mobile.johnchow.com
  • Instead of typing gmail.com to get my email, it’s mail.johnchow.com

You don’t need to know what a CNAME is, you just have to know why you want it and branding is a big reason. Here’s how to do it.

CNAME records are set in the DNS manager of the Registrar that host your domain name. Log into your Registrar and find the DNS manager. From the DNS manager, you’ll be able to find the Zone File Editor.

Click the Quick Add button to add a new CNAME record.

You can add as many CNAME records as you want. The default TTL is 1 hour but I like to set it to the shortest time possible (30 minutes). In the above example, you can see I CNAME cache to point to my CDN. When you’re done, hit the Save Zone File button and your new CNAME domain should be working within half an hour.

Once the zone becomes active, log into you Content Delivery Network provider (MaxCDN in my case) and add the new custom domain name (cache.johnchow.com in my case) into your Pull Zone settings.

Once that’s done, log into your WordPress control panel, go into W3 Total Cache, select CDN settings and enter your custom domain in the “Replace site’s hostname with:” field.

You’re done. Your CDN will now have your domain name in it instead of the CDN provider’s.


36 thoughts on “How To Add a Custom CNAME DNS Record”

  1. d3so says:

    I’ve always wondered what a CNAME is. Basically, it’s a subdomain, correct?

    1. John Chow says:

      Not really. A subdomain is yourname.com/subdomain. Also a subdomain stays on your site and doesn’t go somewhere else.

      1. Tomas M says:

        CNAME does not have anything to do with your domain registrar. It just happens to be that many of the current registrars offer free NS (for domain name resolution) so you use your registrar’s interface to setup CNAME, and your domain uses your registrar’s free DNS servers to host your zone file. You can still find registrars which do not offer this service, just fort the record.

        CNAME is basically a subdomain, exactly as d3so said. Even the www record is a ‘subdomain’ and it can have its own CNAME destination or it’s own A record (IP address). It just happens to be that many of the web hosting services allow you to access your web subdirectory as a subdomain, but again that doesn’t need to apply to all webhosts. Furthermore, for that to work, you MUST have a wildcard CNAME record in place, it is something like this: * IN CNAME @

        One final thought: maxcdn’s interface won’t work with your CNAME unless you tell maxcdn about your new CNAME, as John pointed out. On the other hand, Speedy Mirror doesn’t need any such setting, it detects that automatically.

        1. Hey John,

          Thanks for this comprehensive post. Branding is certainly very important and it looks tidy too.

          There’s nothing like having a custom name.

          1. PPC Ian says:

            I completely agree! There’s a lot of good branding that comes out of a tidy, professional URL. Awesome post, John! I really enjoy these technical posts!

        2. Fazal Mayar says:

          Tomas, wonderful help. You explained it well buddy!

      2. Actually, John anyname.yourdomain.com would be a subdomain and yourdomain.com/anyname is just a directory.

        A Cname is essentially a subdomain just in a canonical form instead of an A Type record. You can also make AAAA subdomain records.

    2. Good info, but how many people really need to know this?

      1. Justin says:

        I am one of the people that requested this information. Newbie here, just wanted to make sure that I didn’t mess anything up.

  2. Pothi says:

    I have just done that for one of the volunteer projects and it works great. Good way to hide the CDN provider apart from decreasing the load time by minimizing the DNS queries!

  3. Hey John,

    Just made a very big deal in affiliate marketing.

    I started blogging in 2007, taking inspiration from you.

    Whatever I am today is because of you.

    You are “The Alchemist” who can turn Lead into Gold.

    Thanks
    Shanker Bakshi

    1. Hey Shanker,

      That’s as very nice comment of gratitude and of thanks to John. He is very helpful and an inspiration to a lot of people.

  4. Leaving your name everywhere in style.

    That is the main reason.

    1. I owe him, it’s his due ZK. 🙂

  5. Eithen says:

    I had heard about CNAME , but I knew what it is and what it does. Thanks John for this information.

    1. PPC Ian says:

      Agreed! I got a lot out of this post. I love learning this stuff! 🙂

    2. Nice, but I’ll probably never use it.

  6. Kate Kutny says:

    A CNAME looks so much better than a subdomain. I never knew this before about CNAMES. It was a great help. I will have to try this out sometime. Thanks John!

  7. Super great..this is something i might just do..thanks

    “Black Seo Guy “Signing Off”

  8. fas says:

    Thanks for the informative post John.

  9. Justin says:

    Awesome John, You are a man of your word. Thanks a lot for posting this for us non tech people.

    1. Hey Justin,

      Posts like this are gold for everybody and especially for non tech people which I think are a majority of people who read his blog and in general too.

  10. John Rampton says:

    I really need to do this

  11. You said that you are using MaxCDN, but in the registrar it is showing NedDNA? Did i miss something here?

    1. John Chow says:

      MaxCDN is owned by NetDNA.

  12. John have used the MaxCDN link from last week and it works great!

    Will take it one step further with CNAME entry.

  13. christina says:

    recently i bought an domain and hosting in godaddy but unfortunately its not getting live in online what will be the problem john

    1. Fazal Mayar says:

      Are you talking about an addon domain? After inserting your nameserver infos on your domain on godaddy, you need to click ‘ Addon domain’ and type in your domain, so you add it to your hosting package.

      1. jasmine says:

        i have got domain name and hosting from godaddy, but both are in different accounts, how to transfer that domain into hosting account.

      2. I don’t even want to deal with GoDaddy.

  14. I haven’t got a clue what any of this means – John you mention it helps with branding – and I presume from the comments that has to do with your name being on some hidden part of a web script instead of your hosts(?); but how does this help exactly?

    Thanks
    Peter

    1. John Chow says:

      It increases your brand awareness. Your brand is your biggest asset. Anything you do to increase it is good.

  15. Abhik says:

    So, you created the CNAME at domain registrar’s end.
    What’s the difference if I make one on hosting provider’s end?

  16. recently i bought an domain in godaddy found so difficult for access on its control panel

  17. singer divya says:

    me too having the same kind of problem, where i have bought domain from one account , and hosting from another account, dont know how transfer that into same account

Comments are closed.