Virtual host / domain only works without www. prefix

Posted March 4, 2016 10.1k views

Would like to know where i’m making a mistake with the 2 sites i have that i can only access like : instead of

I have 3 domains / virtual hosts setup and 1 of them is working perfectly.
However the 2 other are setup identical but have this problem.

I did also sudo service apache2 reload to take the new settings but nothing has happened.

Thank you very much for your help.

  • com.conf file looks like this

    DocumentRoot /var/www/

  • Do you get the error message - Server not found? If yes, it means your DNS isn’t configured correctly.
    Do you have control of your DNS records? You should create a CNAME record for “www” that points to Or you can create an A record for “www” that resolves to the same ip address as

  • I am getting

    This webpage is not available

    I do have control and they are setup exactly as the previous one that actually works.

  • I have added cname but however on 1 of the sites i am experiencing this :

    Site down or blocked is down or blocked.

    Check your internet connection and retry

    Any hints ? Thank you.

    The other site is resolved and works perfectly, thank you very much for your effort.

  • @nepsilon Did you add prefix “www” in your domain while adding it here:
    Like if you add your domain as:, you won’t be able to access it with www. Add both with and without www prefix to access your website in both conditions.
    I hope this helps.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


Based on the error message you’re receiving (NAMENOTRESOLVED), there is an issue with DNS records for this domain that is preventing it from resolving outside of the ‘www’ subdomain. To correct this, you will need to update the DNS records for this domain to ensure that the root domain resolves to the same IP address as the 'www’ subdomain (with an A record of its own), or else that it contains a CNAME record pointing to the 'www’ subdomain, which will result in it resolving to the same IP address as the subdomain by default.

Hope this helps!

DigitalOcean Support