Which DNS entry should I configure to use the domain name without www?


If I have domain name example.com, and if I set an A record for www, www.example.com will return the IP address specified in A record. And what should I configure if I want to resolve example.com (without www.) to an IP address?

Adjust the DNS settings for example.com. Make sure you have address records (type A records) for both example.com and www.example.com, with the same IP address.

If you are using virtual hosting to provide many websites on a single IP address, you will also need to tell your web server about the alternative name for the site. In your web server's configuration, add example.com as an alias for www.example.com. In an Apache server httpd.conf file, this typically looks like:

<VirtualHost *>
    DocumentRoot /home/www/web
    ServerName www.example.com
    ServerAlias example.com