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
Post a Comment