Many times you would want to forward your root domain to a subdomain of your website. The root domain which is also referred to as the naked domain or the bare domain is the website url that does not have an entry before the site name. For example, the URL http://lostsaloon.com or http://google.com are examples where it refers to a root domain.
A website can have several subdomain. An example is http://www.lostsaloon.com or http://domains.google.com where the www and domains are subdomains of the respective domains. By convention, the www is the subdomain where the website of a domain is hosted, while mail might be where the mail server is hosted.
You should forward the root domain to the www subdomain (or vice-versa) for several different reasons. There are several different ways to do this as mentioned in this post. Those techniques work well if you have access to the configuration files on your server. Sometimes you do not have access to those files, or you have a static website.
If you have a static website, then you probably use a static storage bucket on your cloud. This could be any website hosting provider or a cloud provider that you use such as Amazon AWS or Google Cloud storage, for example. This means you will need to configure the root domain forwarding on your DNS server.
If you use Google Domains to manage your domain name, then you could do this from the domain management console. Other DNS providers should have similar options as well.
First go to Google Domains, and click on My Domains in the left hand side menu, as in the screen shot below…
Now click on the domain you want to manage, and then click DNS in the left hand side menu
Scroll down to the section which says Synthetic Records
Add a new synthetic record using the following values:
- Select subdomain forward option in the dropdown menu
- Enter @ for the subdomain. This represents the naked or root domain.
- Enter the subdomain URL which is the URL you want to forward to. (eg. http://www.lostsaloon.com)
- Select Permanent redirect
- Select Forward path
- Select Enable SSL
Click the Add button to persist the changes.
Your record should look something like the screenshot above. Now let the record propagate through servers for a few hours and verify that the redirect is working. Usually it works within minutes.
I have used Google Domains here as an example, because that is the domain provider I use. This should work with any of the other providers as well, though the terminology might be different.