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:
- Adding a DNS Record
- 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 Digital Ocean Droplet 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:
- Login to Digital Ocean Account account
- Go to Networking> Domains> select yourdomain.com
- Add a new A Record like this: www.newsite in “Enter Name” field and your droplet IP in “Host” filed like you see below.
- Hit Create A Record button and you`re done!
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.
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
- Go to Sites> select your site (subdomain in my case) and click on it
- Then open the Redirect tab
- At Redirect Type select R=301,L
- 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!