connecting the domain to hosting yourself
You don't always have to buy a domain from the same company you bought your hosting from, many companies like BlueHost or GoDaddy and others give you a free domain, in these cases, you will find that the domain is directly linked to the hosting and you don't need to redirect anything.
Hey hey, we may have complicated it a bit before we started, let's try to simplify things again:
Your site itself is not the hosting, but it is the sum of the files that give the general look of the site, and for people to reach your site, you need a server connected to the Internet all the time to put your site files on it.
This server is your hosting, and it's often part of a large server with hundreds or thousands of other websites, that a Web Hosting company like GoDaddy, HostGator, or others rent to you.
As for the domain or domain, it is the name of your site, in our case on this site our domain is HostingTops.net
We hope that the picture is clearer now, and we will learn in this article how to connect the domain with hosting or your own server, or any other server if they are from two different companies.
Before that, if you have not chosen your next hosting and want to learn how to connect the domain to hosting before you fall into any trouble, that is excellent, and we advise you to look at this table that gives you a quick comparison between the best global hosting companies:
When do we need to link the domain with hosting?
The simplest answer is when the domain was purchased from one company, and the hosting was purchased from another company.
When can you get this situation?
- When you buy hosting, you can put more than one site on it (that is, you can add Addon Domains to it) as we explained in the article comparing the best hosting, most likely you will get a free domain with the hosting, but what if after a while you want to build another site? You will buy a new domain, it could be from the same company, or you could have seen what we wrote about the best domain reservation site and decided to buy from NameCheap, for example, in this case, you will need to connect your new domain to your hosting.
- Or a friend of yours may have offered you to host your site with him in case you are a beginner and want to experiment, and you do not have the budget even to buy cheap hosting, in this case, you have to buy a domain and then link it to its hosting (you can get it for $1 for the first year of 1&1 which It became IONOS by clicking here, or from Godaddy for $5 after they stopped the $1 offer.
How can hosting be linked to a domain?
- Now let's move on to practical talk, and learn how we can redirect the domain to your hosting files.
- Mostly, your hosting will support cPanel, which is a control panel that gives you the ability to easily control your hosting, from downloading files, installing SSL certificates, creating emails, and also managing domains, and this is exactly what we want here (if your hosting does not support cPanel, you just have to know where it is from Adding domains to hosting.
- Adding the domain to the control panel
- You will have to add your domain under Addon Domains in the Domains section as you can see in the image:
- In the next screen, you will find all the domains on this hosting, add your domain under Create an Addon Domain as in the picture, leave the subdomain as it is, and at the third box it will ask you where you want to add files under this domain, is it on the main folder or on a subfolder For the domain, it is better to create a subfolder to keep your hosting files better organized if you want to create a username for the domain to be able to upload the site files using FTP, tick the right place in the specified place (you can create the user later):
- Then the new domain will appear in the list at the bottom of the screen, so you have completed adding the domain to the control panel, and it remains to tell the domain itself to direct all visits to the new site, which is the place you booked on the hosting.
- By the way, the site in this case does not have any files, and when you start building your site using a ready-made CMS like WordPress, the files will be added under the folder you chose in the Document Root field.
- Redirect domain to hosting
- Now we have to redirect the traffic arriving on our domain to the new site we booked on hosting, which is very easy but just needs some focus.
- The domain or domain contains many inputs or to call them (control values) Records, some of which refer to the hosting server, some of which refer to redirection from one protocol to another, and some of which refer to the site of the email server and not the hosting, and so on.
- The value we want to change is NS Record, which is an abbreviation for Name Server, this value tells the domain where the server that contains the site files is located, which in our case is the server at the hosting company.
Where do we get this value?
- If you are a little lazy, you can contact technical support to inquire, but the fastest for you is to search on the Internet for steps to know these servers for your company, for example, if your hosting is on HostGator, write on Google:
- How to find my name servers on Hostgator
- Most likely you will find an article that shows you how to extract this value, whether it is your hosting or someone else's hosting a friend before you put your site there, you need to get this value to store in the domain information.
- After obtaining this value, head to the domain settings (let's say it's on Godaddy), go to the Domain Manager, choose the domain you want to redirect, then click on Manage DNS at the bottom as you can see in the picture, a box for servers will appear, click on Change To change it and put the server settings of your hosting.
- On other sites such as NameCheap, you will find it a little easier. We have always said that Godaddy is not the best in terms of the control screens and the changes they make, just click on the word “Manage” to the right of the domain you want, and you will find the settings for the Name Servers located directly as you can see:
- It is always preferable to put more than one Name Server to ensure that the redirection will continue to work in the event of a server failure.
- With this, you have completed the necessary settings on your part, and according to the company that owns the domain, it will take some time to update the new values with DNS servers around the world, in large companies, it will not take several minutes, but it may need more in some other cases, usually, they tell you That updates may take 48 hours to reach all DNS servers in the world, but this is an unrealistic number, most if not all of the updates become effective within less than an hour.
How can I make sure that the settings for linking the domain to the hosting are 100% correct?
- After completing all the above steps, we need to verify that our domain is pointing to its new site (its new hosting), and to do that, wait a few minutes and then do the following:
- Open the command screen on your computer by pressing Start, then typing CMD, then Enter
- You will see a black command screen, do not worry, no one hacked you and you will not become a hacker if you type some commands on this screen 🙂 Type Nslookup and then Enter
- Type set type=ns (taking into account the spaces exactly as written here) and then Enter. See the following picture for details.
- Type your domain name, and the names of the servers that the domain refers to will appear. If the new servers you entered appear on your hosting site, this means that the domain points correctly to its new location. If the old servers appear, wait for some time, close the command screen and then re-enter. Open it, type ipconfig /flushdns, and try again