I got a new server and a new website and now my website is not working with www prefix, but is accessible without www prefix.

The solution of this problem it has a easy fix, but it involves 2 different actions:

  1. Adding a DNS Record
  2. Redirecting a www to non-www (as this was my goal)

After I had installed a new website on a newsite.domain.com subdomain it worked perfectly, but when i type the www prefix i get “the webpage is not available” kind of error.

To put things in perspective, I use a [tipso tip=”DigitalOcean claims that its “Droplets,” its branded term for cloud servers, can typically be provisioned in 55 seconds.”]Digital Ocean Droplet[/tipso] with ISPConfig 3 Server on a Debian Jessie OS. But this can work on a wide range of configurations.

Here is how I fixed this:

First step go to Digital Ocean website and sign in: 

  1. Login to [tipso tip=”Digital Ocean Account”]DO[/tipso] account
  2. Go to Networking> Domains> select yourdomain.com
  3. Add a new A Record like this: www.newsite in “Enter Name” field and your droplet IP in “Host” filed like you see below.  
  4. Hit Create A Record button and you`re done!

DigitalOcean A records 2
Remember to change with YOUR IP address of your sever.

I asume  that you already have the non www record added, if you don`t do the same thing without the www in front of your newsite subdomain like you can see below

DigitalOcean A records 1

Note! If you have a cPannel you can add that record in your cPannel dashboard, DNS section

Second step – go to your ISPConfig dashboard and login

  1. Go to Sites> select your site  (subdomain in my case) and click on it
  2. Then open the Redirect tab
  3. At Redirect Type select R=301,L
  4. From SEO Redirect select www.domain.tld => domain.tld

This is it!

Do you have a better solution? I`ll be happy to hear about it! Feel free to leave a comment below and share your thoughts.