How to make a subdomain with the www and non-www
|
|
It is not always necessary to register a new domain name when the one you already own will work perfectly fine. Rather than registering a new domain name, you can always create a subdomain using a domain you already own. A subdomain is a second website, with its own unique content, but there is no new domain name.
First lets understand the differences between the A, CNAME, ALIAS and URL records
Here’s the main differences:
The general rule is:
A common example is when you have both example.com and www.example.com pointing to the same application and hosted by the same server. In this case, to avoid maintaining two different records, it’s common to create:
First lets understand the differences between the A, CNAME, ALIAS and URL records
Here’s the main differences:
- The A record maps a name to one or more IP addresses, when the IP are known and stable.
- The CNAME record maps a name to another name. It should only be used when there are no other records on that name.
- The ALIAS record maps a name to another name, but in turns it can coexist with other records on that name.
- The URL record redirects the name to the target name using the HTTP 301 status code.
- The A, CNAME, ALIAS records causes a name to resolve to an IP. Vice-versa, the URL record redirects the name to a destination. The URL record is simple and effective way to apply a redirect for a name to another name, for example to redirect www.example.com to example.com.
- The A name must resolve to an IP, the CNAME and ALIAS record must point to a name.
The general rule is:
- use an A record if you manage what IP addresses are assigned to a particular machine or if the IP are fixed (this is the most common case)
- use a CNAME record if you want to alias a name to another name, and you don’t need other records (such as MX records for emails) for the same name
- use an ALIAS record if you are trying to alias the root domain (apex zone) or if you need other records for the same name
- use the URL record if you want the name to redirect (change address) instead of resolving to a destination.
A common example is when you have both example.com and www.example.com pointing to the same application and hosted by the same server. In this case, to avoid maintaining two different records, it’s common to create:
- An A record for example.com pointing to the server IP address
- A CNAME record for www.example.com pointing to example.com
A CNAME record must always point to another domain name, never directly to an IP address.
How to make a CNAME and redirect it
(we are using ENOM records, the website domain name is "mydomain.com"
(we are using ENOM records, the website domain name is "mydomain.com"
1 Make the subdomain record as shown in '1' above.
2 Make the www of the subdomain record you have just made as shown in '2' above.
By completing both steps above you now have a www.subdomain.mydomain.com URL and a subdomain.mydomain.com URL. Choose which ever URL will be used on your new website because when people type in both URLs the website will work. It is also recommended that you make a URL redirect from the URL you are not using.
If you are re-branding an old website with a new subdomain web address you will still want the old links to redirect to the new subdomain. Old website links are cached on the internet, if there is no redirection of these old links you will be given a '404 not found' message. Follow the steps in 3 and 4 to redirect those old www and non-www links to the new URL (web address).
2 Make the www of the subdomain record you have just made as shown in '2' above.
By completing both steps above you now have a www.subdomain.mydomain.com URL and a subdomain.mydomain.com URL. Choose which ever URL will be used on your new website because when people type in both URLs the website will work. It is also recommended that you make a URL redirect from the URL you are not using.
If you are re-branding an old website with a new subdomain web address you will still want the old links to redirect to the new subdomain. Old website links are cached on the internet, if there is no redirection of these old links you will be given a '404 not found' message. Follow the steps in 3 and 4 to redirect those old www and non-www links to the new URL (web address).
Sources:
https://support.dnsimple.com/articles/differences-between-a-cname-alias-url
https://support.dnsimple.com/articles/cname-record/
https://support.dnsimple.com/articles/differences-between-a-cname-alias-url
https://support.dnsimple.com/articles/cname-record/
|
|