|
/ Documentation /Site SEO Analysis/ How to Fix WWW and Non-WWW Version Redirects to Improve Your SEO

How to Fix WWW and Non-WWW Version Redirects to Improve Your SEO

If you’ve received a critical SEO warning in SureRank saying:

“Site does not correctly redirect between www and non-www versions”

This article will help you understand what this means, why it’s important, and how to fix it even if you’re not a technical person.

What’s the Problem?

Your website can often be accessed using two different versions:

Both might show the same content. But unless one version automatically redirects to the other, search engines treat them as two different websites.

That means your site is being split into two copies, and each page exists in two places even though it’s the same content.

Why This Matters for SEO

Search engines like Google see example.com/page and www.example.com/page as two separate URLs.

That leads to:

  1. Duplicate Content: Google might think you have copied content on your own site.
  2. Split Link Equity: Backlinks could be divided across both versions, reducing your domain authority.
  3. Confused Search Engines: Google may not know which version to index or show in search results.
  4. Wasted Crawl Budget: Googlebot may crawl both versions unnecessarily, wasting its time.

In short: This hurts your SEO performance.

Who Should Fix This?

If you’re not technical or don’t feel confident editing server files:

We strongly recommend you contact your hosting provider’s support team and ask them to help you redirect one version of your site to the other.

Here’s what you can say:

Hi,
I want to set up a 301 redirect so that my website always loads either the www or non-www version (only one).
Can you help me configure that redirect on the server?

But if you are comfortable making edits yourself, or your host doesn’t offer help, read on.

Step 1: Choose Your Preferred Version

There is no SEO difference between using www and not using it. It’s just a personal preference.

Just pick one and stick with it.

Step 2: Redirect Using .htaccess (for WordPress on Apache Servers)

If your site is hosted on Apache (most shared hosting like Bluehost, HostGator, SiteGround), follow these steps.

How to Edit the .htaccess File

  1. Go to your hosting control panel (like cPanel)
  2. Open the File Manager
  3. Find the .htaccess file in the public_html folder
  4. Right-click → Edit

If you don’t see the .htaccess file, make sure hidden files are visible.

A) Redirect www → non-www

If you want your website to always load without www:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

Explanation:

  • RewriteEngine On: Enables URL rewriting
  • RewriteCond: Checks if the URL starts with “www.”
  • %1: Captures everything after www.
  • R=301: Permanent redirect (best for SEO)
  • L: Last rule, stop processing further

B) Redirect non-www → www

If you want your website to always load with www:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Explanation:

  • This checks if the URL does not start with www and redirects it to include www
  • %{HTTP_HOST} pulls the current domain (e.g., example.com)
  • %{REQUEST_URI} pulls the rest of the path (e.g., /about)

Important Tips

  • Always keep a backup of your original .htaccess file before editing.
  • Make sure you already have SSL (https://) working. These redirects assume your site is secure.
  • If you already have other rewrite rules (like for WordPress), add this above the # BEGIN WordPress section.

Step 3: Test the Redirect

Once you’ve added and saved the changes:

  1. Try visiting the non-preferred version in your browser.
    • e.g., go to https://www.example.com
  2. It should automatically redirect to your preferred version — e.g., https://example.com
  3. Use tools like:

If it doesn’t work, double-check your .htaccess for typos or contact your hosting provider.

Step 4 (Optional): Set Preferred Domain in Google Search Console

If you use Google Search Console, make sure to:

  1. Add both versions of your site:
    • https://example.com
    • https://www.example.com
  2. In the property settings, choose your preferred version

This helps Google understand your site’s structure better.

What About NGINX Servers?

If your server uses NGINX (common in VPS or cloud setups), the redirect must be configured in your server block.

Here’s an example for NGINX (not for beginners):

A) Redirect www → non-www:

server {
    server_name www.example.com;
    return 301 https://example.com$request_uri;
}

B) Redirect non-www → www:

server {
    server_name example.com;
    return 301 https://www.example.com$request_uri;
}

You’ll need to restart NGINX after making changes. If unsure, ask your hosting company to do it.

Summary

  • SEO depends on having one canonical domain, not both www and non-www
  • Choose one version
  • Use .htaccess (for Apache) or NGINX config to redirect the other version
  • Use 301 redirects, not JavaScript or meta refresh
  • Test thoroughly

Need Help?

If you’re unsure or get stuck: Reach out to your hosting provider and ask for help setting up a redirect between www and non-www.

Getting this right improves your site’s SEO and prevents future indexing issues.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page
Scroll to Top