How to add subdomain entry
Asked Answered
M

2

7

I have a domain name (somename.com) registered at godaddy and i am using godaddy DNS Manager. But i am hosting my website with hostinger.com. So i have created a subdomain (sub.somename.com) on hostinger which by default points to same IP as a domain.

Now i have entry on godaddy DNS for my domain and subdomain name which points to hostinger server address where my website hosted. But when i access my subdomain (sub.somename.com) it goes to my somename.com. I have to refresh it to load sub domain page correctly.

Godaddy DNS Entry

domainname -- somename.com -> IP address of hostinger.com

subdomain -- sub.somename.com --> IP address of hostinger.com (same as above)

Hostinger DNS Entry

subdomain -- sub.somename.com --> IP address of hostinger.com(same as above)

  1. Is above entries is correct ?
  2. Should we need to have entry for domain and subdomain both on godaddy DNS ?
  3. Do we need to have a entry for subdomain in hostinger.com also ?
Minica answered 12/7, 2016 at 7:44 Comment(0)
V
10

In order to create a subdomain correctly you have to go through 2 steps:

1. Update your DNS records, so they accept your subdomain (sub.somename.com).

You should have these records for your setup:

  • A: @ -> IP of hostinger.com (this is to connect the domain with hostinger)
  • A: sub -> IP of hostinger.com (only put the subdomain name)
  • CNAME: * -> somename.com (so that everything before somename.com goes to somename.com)
  • CNAME: *.sub -> sub.somename.com (so that everything before sub.somename.com goes to somename.com)

There are different types of DNS Records, the one's you mentioned are all A Records, you have to use CNAME Records as well.

2. Creating a virtual host (on the hosting provider)

The previous step was so that the Domain Name Servers know to which ip to point when the subdomain is used. From this side we have to point the subdomain address (sub.somename.com) to a specific folder that contains the different website. Most host providers, when you create a subdomain automatically create a new folder you can put your content at and point at it.

So to answer your questions.

  1. No you have to change your DNS Records so they match the information above. Let me remind you that changes in the DNS Records might take a while to take effect (1-2 hours).
  2. Your DNS entries should be at one place. Usually they are provided by the hosting provider (hostinger in this case), but since they are also provided by GoDaddy as well feel free to update them there.
  3. There is no need to have a DNS entry in hostinger if you update them in GoDaddy.

P.S. Since I haven't used hostinger before, feel free to update me if you have more info, like if you're using CPanel.

Valer answered 13/7, 2016 at 12:12 Comment(0)
C
6

If you intend to host a subdomain at an IP different than your main site, the records should look like this.

Main Site (mysite.com)
Type: A
Name(Host): @
Value(Points To): 192.168.1.1


Blog Site (blog.mysite.com)
Type: A
Name(Host): blog
Value(Points To): 192.168.1.2

As a reference, you only need an A record to host a subdomain. CNAME record is an alias. www records are usually CNAME records to the root domain as they are the same page.

Hope this helps!

Cailly answered 26/3, 2017 at 2:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.