The Ultimate Guide to DNS for WordPress
DNS can be a headache. It’s one of those aspects of website management that can either be a breeze or take days to sort out.
I should know – I recently spent a week trying to transfer a domain name, which eventually involved failed redirects, htaccess editing and the site going down! Luckily it’s fixed now.
But my experience shows that it helps to understand exactly what DNS is, what aspects of domain management do what, and the correct way to go about managing, moving and redirecting your domains.
In this post I’m going to cover everything I believe you need to know about DNS to manage your WordPress site. I’ll define the key terms and give an overview of how to go about doing different things. I’ll include nameservers, MX records, parked domains and lots more.
Continue reading, or jump ahead using these links:
- Domain Registration
- Managing Domains with Your Registrar
- Redirecting, Adding and Parking Domains
- Domains and Email
- Tracking Your Domains
The first thing to do before you can carry out domain management is register a domain with a domain registrar.
A domain name is a system used by browsers to access a specific IP address. Your website will actually be hosted at an IP address, but by buying a domain name and pointing it at that IP address, anyone typing your domain name into a browser will be taken to that address. This will be done automatically by your provider.
This could be the same as your hosting company or it might not. The domains I manage are all registered with a different company from my hosting provider. This is because over the years I’ve switched hosting providers as my needs have changed, while my domain registration needs haven’t changed. I’ve always preferred to use UK-based domain registrars as most of the domains I buy are .uk ones, and it’s sometimes not possible (or too expensive) to buy those with registrars in the US. But my hosting providers have been based in Ireland and the US – although I now use SiteGround in the UK.
Most people will have their domains and hosting with the same provider. This makes sense, especially if your hosting provider gives you a free domain with your hosting package. It also means you’ve got only one provider to deal with. But if you experience problems with one or the other, it can help if they’re separate.
For example, last year my old hosting provider was taken over and their service went downhill fast. For a month I couldn’t access my hosting account. A whole month! Luckily because my domains were registered elsewhere, I was able to access those and direct them to a new hosting provider. It was a headache, but not as bad as it could have been.
So whether you keep your domains and hosting together or separate is up to you. If you’re just managing one site, I suggest doing both with the one provider – it’ll be cheaper and easier.
Managing Domains with Your Registrar
Once you’ve bought a domain, you’ll have access to DNS via your provider’s website. DNS stands for Domain Name System, and it’s the tools you use to control where your domain points to.
Before you buy a domain name, check that your registrar gives you full DNS access. Some of the bigger or cheaper providers don’t. I believe every website owner should have full access to all the tools they need to manage their domain, hosting and website – so I strongly recommend you avoid providers like these.
When you access your provider’s DNS management interface, you’ll have a few options. These are the ones you’re most likely to use:
- Nameservers – use this to point your domain at another provider. This redirects everything: website, email, FTP – everything. I add custom nameservers to my domains because I have my hosting with a different provider. If you don’t change the nameservers, they’ll default to your registrar’s servers. This is what you need if you also have your hosting with them, so you won’t need to change anything.
- A record – by editing the A record, you can direct your domain at an IP address. Use this if you want to direct your domain to an IP address other than the one provided by your domain registrar. It only affects the website, not any email accounts on that domain.
- CNAME – the CNAME record works in a similar way to the A record but instead of typing in an IP address, you use a domain name. So you would use this to direct your domain to another domain. An example might be if you’ve registered a .com and a .net address (or a local address such as .co.uk) and want to redirect one to the other.
- MX record – this specifies the server where you have your email hosted. I always use Gmail for email with my own domain, rather than hosting it at the same place as the website.
All of these can be edited via your registrar’s system, and some can also be edited via cPanel. I recommend using cPanel where possible as it gives you more flexibility.
Note: WPMU DEV also offers DNS Management for members. We recommend hosting with WPMU DEV and bringing your domain’s DNS records over if you plan to set up a Multisite environment, as we support and offer free Wildcard SSL.
Redirecting, Adding and Parking Domains
For most website owners, you’ll keep your domain on the servers provided by your registrar and hosting company, and won’t need to make any changes. But if you have multiple domains pointing to the same site, you’re using a different hosting provider and registrar or you’re using WordPress Multisite with Domain Mapping, you’ll need to know how to redirect your domain(s).
Changing the Nameservers
If your website isn’t hosted with your domain registrar, you’ll need to set custom nameservers. Each domain registrar will have a different interface for doing this; my registrar has a dedicated page for each domain that I access via my client area.
Your hosting provider will give you details of the nameservers you should use when you create your account with them: there will be at least two.
Once you’ve done this, all aspects of your domain will point to the new nameservers – so any domain management will be done with your hosting provider. You won’t need to access your domain registrar’s interface again.
Manage unlimited WP sites for free
Sometimes you’ll want to redirect one domain to another domain. Examples of this include:
- You’ve registered multiple versions of your domain name and want them all point to the same place.
- You have more than one domain name but only one site (for example your business trades under two names or you’ve registered one domain with your business name and another that describes what you do).
- You need to temporarily point a domain to a holding site while you develop a new site.
There are a few options for redirecting the domain:
- Use the CNAME record with your domain provider to redirect to another domain name.
- Use the A record to redirect to another IP address.
- In cPanel (which you’ll get with your hosting account), use the Redirects option and add any redirected domain names via that interface.
Creating Addon Domains
An addon domain is an additional domain that you use within your hosting account to create an additional website. So if you want to run more than one website, you don’t need to pay for multiple hosting accounts – instead, create an addon domain and run your second site using that.
You create addon domains in cPanel with your hosting provider. Once you’ve created one, a subdirectory will be added to your account corresponding to that domain. Install WordPress in that subdirectory and it’ll resolve to the addon domain, not to the domain in your root directory.
For example, I have my hosting account set up with the domain name compass-hosting.co.uk, which I use to host client sites using WordPress Multisite. For my personal site I don’t want to use my Multisite network, instead, I have a standalone WordPress installation. So I created an addon domain for rachelmccollin.com which created a subdirectory at compass-hosting.co.uk/rachelmccollin.com. I then installed WordPress there and created a completely new site. When I visit that site it resolves to rachelmccollin.com, not to compass-hosting.co.uk/rachelmccollin.com.
Note: before creating an addon domain, make sure it’s pointed to the same server as your main domain. If you’re using your hosting provider for domains this will automatically be the case.
Another option in cPanel for pointing a domain at your site is to use a parked domain. This is different from an addon domain in that it doesn’t create a folder for a new website. It’s also different from a redirect in that it gives you access to domain management tools in cPanel for your domain, such as email.
To park a domain, go to Parked Domains in cPanel and add the domain that you want to park.
I use this option when I’m directing domains at my Multisite installation. I can specify where the domain will point to (i.e. my compass-hosting.co.uk domain) and I can also manage any domains I’ve parked right from within cPanel. Which is useful for email in particular.
Note: You’ll only need to park a domain if it isn’t already pointing to your hosting account. If you’re using the same hosting provider and registrar you should be able to skip this.
Domains and Email
Domains aren’t just used for websites: they apply to email too. I prefer to keep my and my clients’ email accounts hosted separately from my website hosting, for three main reasons:
- By using Gmail I have access to a much better interface
- It’s easy to add an email using Gmail to any email client or mobile device, as well access online.
- If my website goes down, I can still use my email. I learned this the hard way many years ago, the first time my hosting account went down – my clients were far less bothered about the loss of their website than they were about the loss of email.
To host your email on a different server, you’ll need to use MX records. You can do this via your domain registrar’s interface, but it’s easier in cPanel.
You can either enter the MX records for Gmail manually or if your provider gives you the option, do it with one click. My provider gives me a screen in cPanel where I can do this easily.
Once you’ve done that, you’ll also need to add your domain to your Google apps account. There’s an annual fee for this but I think it’s well worth it.
If you want to keep your hosting and email together, that’s okay too! WPMU DEV provides free email hosting to members.
Tracking Your Domains
Sometimes you’ll find that your domains aren’t doing what you’re expecting them to. This may be because there’s a problem, or it may be because the changes you’ve made are taking a while to propagate. This is the process of your changes working their way around the Internet so they’re picked up by multiple servers. It can take anything from minutes to a couple of days, and I’ve never been able to work out why it varies so much.
To check where your domain is resolving, use whatsmyDNS.
This lets you track where the different aspects of our domain, including name servers, A record, CNAME and MX, are resolving. It’ll show you any difference in different parts of the world, which can be interesting to track when you’ve just made changes. And it’ll help you identify any problems.
If your domain still isn’t resolving correctly 48 hours after any changes, and the problem is consistent in all regions according to WhatsmyDNS, then you’ll need to revisit your settings.
Learning to Manage Domains Will Make Your Life Easier
Understanding the basics of DNS management for your WordPress site will help things go more smoothly when you create a new site, move it to a new hosting provider, or buy additional domain names.
If you follow the guide above you should find that the majority of DNS management runs smoothly. Don’t forget to be patient though – DNS changes can take a while to propagate.