There are several potential reasons, but they come down to two main categories: dns or server configuration.
DNS can be tested using ping, dig, nslookup or any other tool, depending on which OS you are using. Basically, if you check the ip address for example.com and www.example.com, both of them should have a NAME IP address (a group of four numbers separated by periods).
IF THEY ARE ACTING, your dns is fine in this case (there are other cases when you would like them to do different things, but right now, just make sure they have the same ip address).
Then you need to specify the configuration of your web server to say that both example.com and www.example.com should use the same files and content. With Apache, this can be done using the ServerName and ServerAlias ββdirectives.
Hope this helps.
source share