Virtual host / domain only works without www. prefix

March 4, 2016 1.1k views
Apache FAQ Ubuntu

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.

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

Have another answer? Share your knowledge.