I am running multiple Wordpress sites on my server. I can load my sites with just **http://**sitename.com but they will not load when I use **www.**sitename.com. 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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi,
There are typically two configurations required to do what you want to do:
www DNS needs to resolve to the same IP as the websites, typically your Droplet IP or another domain that resolves to your Droplet IPFrom 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!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.