9

I have a site , for example test.com.

While i take the site as 'test.com' in the browser i getting the site.

But while i try with 'www.test.com'.Its showing server not found issue.

It doesn't have any htaccess file ,also there is nothing in the index.php page that make this issue .

Any one have any idea

Linto
  • 1,234
  • 3
  • 25
  • 41
  • 1
    This is most probably due to a DNS issue. You have to make sure the domain has an A record for www. (if no wildcard ie: * is present). Open command prompt and ping site.com, and ping www.site.com. If the IP address is the same, you can probably safely assume the issue is on your webserver. Otherwise you will need to point www.site.com to where site.com is pointing to. – Ben Ashton Nov 14 '12 at 23:22
  • See this answer: http://stackoverflow.com/questions/8624663/dns-add-www-prefix – technoTarek Nov 14 '12 at 23:28

3 Answers3

13
  1. check your dns

  2. you may be need added record DNS www IN CNAME domain.com.

  3. send mail to support hosting.

  4. It might be required to add a virtual host for the domain with www and add a permanent redirect in the web server configs eg: httpd.config or nginx.conf. Assume the domain is example.com and the web server is apache.

     <VirtualHost *:80>
         ServerName www.example.com
         Redirect permanent / https://example.com
     </VirtualHost>
    

Enjoy=)

Udara Seneviratne
  • 2,303
  • 1
  • 33
  • 49
Strannik
  • 466
  • 3
  • 6
  • 17
6

There are several potential causes, but they boil down to two main categories: dns or server configuration.
DNS can be tested with either ping, dig, nslookup, or any number of other tools, depending on what OS you are using. Basically, if you check the ip address for both example.com and www.example.com, they should both have the SAME ip address (group of four numbers separated by periods).
IF THEY DO, your dns is fine in this case (there are other cases where you would want them to do different things, but for right now, just make sure that they have the same ip address).
Next, you need to tell your web server configuration, to tell it 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.
Hopefully, this should help.

  • I tested with 'Ping'.I am getting an ip for test.com , but for www.test.com ,it saying "Ping request could not find host www.test.com. Please check the name and try again." – Linto Nov 14 '12 at 23:35
0

You need to edit your DNS settings & records with your domain provider.

tonino.j
  • 3,837
  • 28
  • 27