Question

Duplicate Sites? Canonical Domain? HELP

  • Posted on July 11, 2024
  • DNS
  • beauAsked by beau

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."**


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
July 12, 2024
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.

Who’s Responsible?

  1. Registrar (GoDaddy): Their primary role is to manage your domain name, and can also be your DNS provider.
  2. DNS Provider: The DNS zone that your domain name uses depends on your domain’s nameservers. For example if you are using the DigitalOcean nameservers then you would manage your DNS via DigitalOcean, and if you are using the GoDaddy nameservers, then you would manage your DNS via GoDaddy.
  3. You own your domain name and your hosting, so it is your responsibility to setup your DNS and redirects correctly rather than the domain name registrar or the hosting provider.

Steps to Fix the Issue

  1. Identify Your DNS Host:

    • To check what your nameservers are, you could use the 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.
  2. Set Up Redirects:

    • The DNS is not where you actually configure your redirects though. What you would need to do is to set up a 301 redirect from the non-www version to the www version (or vice versa, depending on your preference). The way that you set that up would depend on the web server that you are using:

Example for Nginx:

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
}

Example for Apache:

<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

KFSys
Site Moderator
Site Moderator badge
July 14, 2024

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:

Apache Configuration

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]

Nginx Configuration

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
    }
}

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.