How to make website/webpage accessible without 'www'?

It would be convenient for users to access websites without having to type 'www' everytime. For example www.abc.bt would be made accessible simply by typing abc.bt . How do we achieve it.

This may be achieved by making changes in DNS and httpd.conf file.

In DNS, there are two ways to achieve it, first with A Record, second with CNAME. But I will show example using A record.

Lets say we have a domain, abc.bt and IP Address of the server on which website is hosted is 192.168.0.10

In the DNS file, create A record as follows:

www.abc.bt        IN       A       192.168.0.10
abc.bt                 IN       A        192.168.0.10


Now edit the httpd.conf file 
          <VirtualHost *:80>
                ServerAdmin webmaster@abc.bt
                DocumentRoot /var/www/html/website
                ServerName www.abc.bt
                ServerAlias abc.bt
                #   ErrorLog logs/dummy-host.example.com-error_log
                #   CustomLog logs/dummy-host.example.com-access_log common
         </VirtualHost>

Restart named and apache, then check the url accessiblity with and without 'WWW'.


Comments

Popular posts from this blog

Solution to Moodle Error: Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

ACTION_FAILED:OU_INVALID: Solution for GoogleApps bulk user upload issue, username@domainname.com:ACTION_FAILED:OU_INVALID. This error is because you have not specified the Org Unit Path properly.

(Solved) (Fixed )MariaDB Unmet Dependencies on Ubuntu 20.04.