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.
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.
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.