Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

For some reason I cannot access my website with the www. prefix.

This is what my current DNS records look like:

example.com      A   192.0.2.99
www.example.com  A   192.0.2.99

Could anyone help me, I am pretty new to this whole DNS business!

Just for clarification, I can access the website without the www.

I can also access the website successfully with the .www prefix when adding the domain with the .www prefix and IP address of the server to my local hosts file.

share|improve this question

migrated from stackoverflow.com Aug 24 '11 at 16:45

This question came from our site for professional and enthusiast programmers.

1  
DNS is only part of the problem. If you have and A record with www, that is step 1. Step two is to have a webserver that recognizes www.example.com. E.g. An apache webserver can be configured to only serve example.com, and deem www.example.com as invalid. Could you provide your domain name? That would help. DNS records also take a little time to propogate, so if you just made the change, it may take several hours. –  Colin Aug 24 '11 at 16:39
    
I can access the site without the .www, thanks for the advice, I will wait a few hours, if nothing has changed then I will report back. –  Muggles Aug 24 '11 at 16:41
2  
Probably best not to ignore Colin's, accurate, advice. –  Chopper3 Aug 24 '11 at 16:51
    
If your A record does not work and your server does indeed allow for the www. prefix, you can then try a CNAME, though only do so at last resort: example.com A 99.99.99.99; www.example.com CNAME example.com. Depending on your DNS implementation, this may not work and it is not the best practice if it does. I highly recommend following Colin's advice first. –  MaQleod Aug 24 '11 at 17:00
    
Colin, by no means am I ignoring your advice! I just want to make sure it is not the domain propagating before making any changes to the server. –  Muggles Aug 24 '11 at 17:16

1 Answer 1

up vote 3 down vote accepted

We need to know much more about your environment to troubleshoot this effectively, but you can narrow it down (DNS vs. other) using a hosts file. Add both names, with and without the www., to your hosts file, ping them both to make sure they resolve correctly (the box may not reply but the ping program should spit out an IP address), and then navigate to them in a browser and see what happens.

By the way, you probably need to close and reopen your browser windows so the browser picks up the new DNS info.

share|improve this answer
    
Hello, I added both lines like you said to my host file and I was successfully able to access the server. –  Muggles Aug 24 '11 at 17:02
    
Resolved, just waited for the DNS to propagate. –  Muggles Aug 27 '11 at 18:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.