Websites do not load with www

Posted June 14, 2019 3.2k views
DNSUbuntu 16.04

I am running multiple Wordpress sites on my server. I can load my sites with just but they will not load when I use I added a DNS CNAME record with www and @ to each website but it redirects to an unavailable page instead of my correct website. It looks like it’s redirecting my websites to my DigitalOcean IP Address. How do I fix this?

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
1 answer


There are typically two configurations required to do what you want to do:

  1. the www DNS needs to resolve to the same IP as the websites, typically your Droplet IP or another domain that resolves to your Droplet IP
  2. your web server configuration (apache or nginx typically) needs to perform a redirect when a site is requested for

From your description of the problem, it sounds like your DNS is setup correctly but the second part, the part that will redirect the www request to the right site, is not.

This past answer has some of the webserver configuration info for Apache and Nginx (right after):

Both of these examples are for a virtual host that listens for the www domain and then redirects it to the non-www version of the site domain. A “301” redirect is a “permanent” redirect (for search engine purposes).

If you’re still stuck and you are using Apache, here is a DigitalOcean tutorial that uses an A record instead of a CNAME - reviewing these steps might help with your issue.

Here’s another tutorial on redirects that includes some nginx info too:

If you are stuck, please reply with a little more information like which web server are you using (apache or nginx, for example).

Hope this helps and good luck!

by Justin Ellingwood
HTTP redirects are used to redirect web site visitors to new locations when they request content. These are useful for a variety of reasons, whether permanent or temporary. This guide will demonstrate how to redirect visitors using Apache and Nginx.