When your domain name and the hosting are not purchased from the same provider, you must connect domain to hosting so that your website can run properly online. it will be same if you build your website on some online website building platform like Shopify or Weebly but the domain is from other registrars.
Most of the time, you can consult the customer support of the domain name registrar and the hosting company if you are struggling to connect domain to hosting, they will help you resolve that. But if you can master one more skill, that’s really awsome, I think, you don’t need to wait for others helping you to figure out things, and the ways to connect domain to hosting is not so difficult as you imagine. Why not follow us and learn today.
Before you Connect Domain to Hosting
To connect domain to hosting plan, of course it requires:
- Domain Name – if you don’t know where is the best place for register a domain, check here.
- Web Hosting – Read Top 10 Best Web Hostings, you may find a good hosting provider.
Connecting your domain name to the hosting involves working with configuring or settings called DNS records(Domain Name System). There are usually two ways to connect domain to hosting or online website building platform.
Method 1: Add ‘A’ Record to DNS Configuration
I will take NameSilo as an example, since I registered my domain names on Namesilo, it is cheap and no additional fees, renewal price same the first purchase for .com TLD, and I have more than 1 domains, it is conveniently to use only one domain registrar manage my domains.
Step 1. Register A Domain name – Connect Domain to Hosting
If you have registered a domain name, skip this step.
Go to Namesilo, Enter the domain name you want to register in the search box on their homepage, and click SEARCH DOMAIN. If the domain name you are searching for is not registered, congratulations, you can add it to the shopping cart directly, click Checkout, and the page will jump to the shopping cart details ( See below). Here is a coupon NS01OFF, you will get 1 dollar off when you use it in the first purchase.
Click on Continue to go for payment, Namesilo offers many payment methods including credit card, paypal, bitcoin…etc, you can choose the most convienent one to make payment. Once you paid the order, you registered the domain.
Step 2. Go to DNS configuration- Connect Domain to Hosting
After purchased the domain name, log in to your NameSilo account, find the domain manager in the right sidebar and click Enter. You can see the domain name you just purchased, click on it, find DNS Records (see that in below screenshot), and click on Update.
the next page you will enter is DNS settings manage page, where you can add some records. No matter where you buy the domain name, you need to find this DNS setting.
Step 3. Create Record and connect domain to hosting
On the DNS zone setting page as the below screenshot, there’re some default records about Namesilo nameserver already exsit, you can add or edit records in the Add/Edit a Resource Record section, but I suggest you delete all the default records to aviod conflict, then add new records.
The way to connect domain to hosting is add a A record to the DNS, you can click the blue A in the record type list, it will show you the form as in above screenshot:
- HOSTNAME (name, generally refers to the name of the domain name or subdomain name) → Leave this field blank or add @, if you also want your website with www for the url, you can add another A record, enter www in this field.
- IPV4 ADDRESS (hosting public IP address) → fill in the public IPv4 address of your hosting in this field. This address can be found on the control panel of the hosting you purchased. Most hosts use cPanel as the control panel. see the IP address in the picture below, the hosting I am using is ChemiCloud, they use cPanel too.
For other hosting companies that have their own control panel like GreenGeeks, Siteground, Hostinger etc, you can find it on the control panel or contact their customer support directly.
As you see Shared IP Address is the public IP address you need, copy it and paste it into the field of IPV4 ADDRESS.
- TTL (Short for Time to live)- Here you can set to 3600, means 3600 seconds = 1 hour, Namesilo only allows the small number is 3600 in this field.
Generally, TTL is the minimum time that the domain spread to hosting, that means you need to wait so long to connect domain to hosting susccessfully. In most cases, this time is 1 hour to 4 hours, sometimes even longer, and sometimes very fast. different domain registrars may allow different minimum TTL. This speed cannot be controlled, no matter which registrar you use, since this is regulated by ICCAN.
Filled in all values, Click on Submit, what you need to do is wait the domain spread to hosting, Want to know if the domain connected with your hosting?
- the easiest way to know if it’s successed is entering your domain into you browser, if it displaying something about your hosting, it is available.
- you can enter ping yourdomain.com in the CMD of windows or macOS’s terminal, if it get back the IP address of your hosting, it means connect domain to hosting is successed.
Connect Sub-domain to Hosting
1. Add A record
If you have some subdomains base on your Top Level domain, For example, shop.example.com or blog.example.com, you can also add an A record into DNS zone like connect domain to hosting as above, but fill in the subdomain name(such as shop or blog or other prefixes you want to use) in the HOSTNAME field, , and IPV4 ADDRESS is same as the public ip of your hosting.
However if you want to host your website with subdomain in a different hosting, you just change the IPV4 ADDRESS to the different one.
Once the subdomain connected hosting successed, you can create a new website like you do with your top level domain, but the root directory of subdomain should be different. If you are using cPanel to create a website, it will create a new directory to associate with the subdomain when you add a subdomain, otherwise, you need to create a new root directory and point your subdomain to this directory in the webserver configuration.
2. Add CNAME Record
You can also connect subdomain to hosting by adding CNAME records. CNAME records are also known as canonical or alias records.
The CNAME resolution process is first pointing a alias to the top level domain name(example.com), and then the top domain has an A record which point to a IP address, the alias finally point to the IP. CNAME records must always point to another domain name, never directly to an IP address.
example.com - A Record - Production Server IP test.example.com - CNAME - example.com
For example, if your domain name is example.com, it has a CNAME record test.example.com point to example.com, then you can also directly use test.example.com redirect to example.com, if you want to create another folder through test.example.com and associate it with the subdomain, and put in a separate website file, then test.example.com will jump to this new website. that’s how to use CNAME connect subdomain to hosting.
The convenience of CNAME is that if you change the hosting provider, you only need to change one A record of the top level domain, you don’t need to change records one by one. But it is said that some search engines are more friendly to A records, that’s because CNAME has to perform 2 DNS lookups, which will affect performance.
Method 2: Change NS for your domain (Name Servers)
Like Hosting managed on its server, a domain is also managed on Name Server(NS). You can also connect domain to hosting by changing Name Servers. Most of the time, you change NS for your domain, you still need to add the necessary records to the DNS zone one by one.
But why some hostings suggest you to use their Name Server? as your DNS zone will automatically be configured to match the hosting’s IP Address once you use the hosting’s name server, and the spread speed is faster when connect domain to hosting. It is also convenient for some people to manage the domain and hosting together.
How to change NS for a domain? – Connect domain to hosting
- still take NameSilo as an example, login to the Namesilo account, go to domain namager – > choose domain name -> Name Servers, Click on Changes, then copy the new name servers and replace the default ones, each line in one row.
- If your domain registrar allow a NS record type in DNS records zone, you don’t need to change the Name Servers, you can go to the DNS zone manage page, add NS records to point to the hosting Name Servers. For example, you can check here to know this method to connect domain to hosting on GreenGeeks.
In another case, you may need to change NS when you use CDN for your website, such as cloudflare. once you changed your domain’s NS to cloudflare, it will transfer all records to cloudflare DNS configuration, you can also add or edit the records on cloudflare too.
Connect domain to hosting of Mail service(MX records)
If you buy some email services separately, such as goolge Gsuit, office365, zoho email, etc., you can point your domain name to their email server to create email like email@example.com. you can follow the email services instruction to get the email server details. The picture below is the records of zoho I used for our e-commerce business. The servers in different regions of Zoho are different.
- HOSTNAME – Leave this field blank or add @susia
- ADDRESS/VALUE/TARGET HOSTNAME – There are two files in this column, enter the mail server which provided by the email serivice company
- DISTANCE / PRIORITY – it commonly has two levels, 10 and 20, and some have three levels plus one to 50.
Each email service is roughly the same, (I can’t explain all of them here, please follow the specific instructions of your mailbox provider), and then add these records to the DNS zone of the domain name registrar. you need to wait like that connect domain to hosting.
More Record Types for DNS
There’re many other record types in DNS zone setting:
- AAAA – Same function as A record, except that the domain is pointed to IPv6 (Internet Protocol version 6), A record is for IPv4, xxx.xxx.xxx.xxx is version 4
- TXT/SPF – “TXT” records allow you to associate free text data with hostnames. TXT records are usually used to verify your domain name. For example, if you want to link your website to the google search engine, google will Add a specific TXT record to your domain’s DNS zone, and then they will search it on your website to identify your domain name;
TXT is also commonly used to create SPF records. SPF is generally an anti-spam record, which will prevent the emails you sent out including in Spam email.
- SRV – The “SRV” record allows you to associate the server’s hostname and port number with a specific service. This is usually used for VOIP/SIP applications.
- CAA – “CAA” records allow you to specify which certification authorities (CA) are allowed to issue domain certificates.
When you use cloudflare CDN for your website, you will find other more record types, but most of those you don’t need to use.
Connect domain to hosting is actually very easy, for many beginners or small website, you only need to know is adding A record to make your website online. that means the method 1 is enough for most people to connect domain to hosting. I just wanted to write down some commonly used methods as much as possible, as well as some situations you may encounter.
This article seems only for connecting domain to hosting, actually, if you use some online website builder like I said in the beginning, the methods are almost same, the difference is that you need to find the IP address for differert builder. Hope this article will help you.