Hi,
We have a long standing issue that was pointed out by the firm doing our SEO. I thought it was the responsibility of GoDaddy (acts as registrar) to solve this but they say it is not.
I look here and see some DNS options but it’s blank. Is Digital Ocean the DNS host? How do I fix this?
**"Duplicate sites
There are two available versions of this site — the non-www version and the www version. This causes internal duplicate content and confusion to visitors and Google. We recommend ordering a canonical domain implementation to redirect the secure non-www to the secure www version of the site."**
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!
Accepted Answer
Hey Beau,
First off, let’s break down the problem: you have two versions of your site — one with “www” and one without.
This can indeed cause confusion for visitors and search engines, leading to potential SEO issues but is quite easy to fix.
Identify Your DNS Host:
whois
command or an online tool like https://who.is/. This will show you where your active DNS zone is and where you can manage your DNS records.Set Up Redirects:
server {
listen 80;
server_name yourdomain.com;
return 301 http://www.yourdomain.com$request_uri;
}
server {
listen 80;
server_name www.yourdomain.com;
# Your existing configuration
}
<VirtualHost *:80>
ServerName yourdomain.com
Redirect 301 / http://www.yourdomain.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.yourdomain.com
# Your existing configuration
</VirtualHost>
Let me know if you have any questions.
- Bobby
Heya,
It seems like you have two versions of your website if I understand correctly. What you’ll need to do is just redirect your domain from http to https. Or even more secure non-www to the secure www version.
Now, I am not sure whether you use Apache or Nginx so here is for both:
To redirect non-www to secure www using Apache, you need to edit your .htaccess
file or your Apache configuration file. Here is an example using the .htaccess
file:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
To achieve the same redirection with Nginx, you will need to modify your server block configuration. Here is an example:
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com;
ssl_certificate /path/to/ssl_certificate.crt;
ssl_certificate_key /path/to/ssl_certificate.key;
return 301 https://www.example.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name www.example.com;
ssl_certificate /path/to/ssl_certificate.crt;
ssl_certificate_key /path/to/ssl_certificate.key;
location / {
# Your existing configuration here
}
}
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.