🚀 Best WordPress GPL Marketplace
Menu

Redirecting Your Website from WWW to Non-WWW: for WordPress Guide

WWW vs. Non-WWW: The Ultimate WordPress Redirect Guide for SEO

Stop diluting your search rankings and fix canonical issues in 60 seconds.

Have you ever noticed that some websites use [www.example.com](https://www.example.com) while others simply use example.com? While it might look like a minor aesthetic choice, this decision carries massive weight for your SEO (Search Engine Optimization). If your website is accessible via both versions, Google sees them as two separate websites with duplicate content. This guide will help you choose the best version and show you how to implement a permanent 301 redirect without a plugin.

What is the Difference Between WWW and Non-WWW?

Originally, WWW (World Wide Web) was a subdomain used to identify a web server. Today, it is largely a matter of preference:

  • WWW Version: Traditionally used by larger websites. It allows for better DNS flexibility and cookie handling for subdomains.
  • Non-WWW (Root) Version: Preferred by modern startups and blogs. It is shorter, cleaner, and easier for users to type and remember.

Why Redirecting is Mandatory for Google

If you don’t pick one and redirect the other, you are hurting your site in three ways:

📉

Split Link Equity

Backlinks pointing to both versions divide your ranking power in half.

👯

Duplicate Content

Google might penalize you for having two identical pages at different URLs.

🧭

User Confusion

Consistent branding requires a single, unified URL structure.

How to Implement a One-Click Redirect via .htaccess

The .htaccess file is the brain of your Apache server. Editing this file is the most efficient way to handle redirects because it happens at the server level, before WordPress even loads.

Option A: Redirect WWW to Non-WWW (Clean Version)

Copy and paste this into your .htaccess file:


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

Option B: Redirect Non-WWW to WWW (Traditional)

Use this code if you prefer the “www” prefix:


RewriteEngine On RewriteCond %{HTTP_HOST} !^www.(.*)$ [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Important Steps After Adding Code:

  • Step 1: Log in via FTP or File Manager.
  • Step 2: Find .htaccess in the root folder (usually public_html).
  • Step 3: Paste the code ABOVE the # BEGIN WordPress line.
  • Step 4: Check your headers using HttpStatus.io to ensure it returns a 301 Moved Permanently status.

Check DNS Propagation

Ensure your IP points correctly across the globe.

Verify with WhatsMyDNS →

Check Redirect Health

Verify that the 301 redirect is working without “redirect chains.”

Verify with HttpStatus →

Final SEO Tip

Once you have implemented the redirect, go to your Google Search Console and ensure your “Canonical URL” matches your chosen version. Also, update your Sitemap.xml to reflect only the version you want to rank.

Need help with advanced .htaccess configurations? Visit WPCodeQuill for custom PHP and server scripts.

Would you like me to generate a featured image for this redirect guide?

Leave a Reply