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 would want to 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. But if you are have a static website and using a static storage bucket of some sort, then you might not have access to some of the configuration file and will need to configure this at the DNS.
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 menu
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.