How to Redirect Non-WWW URLs to WWW?

Duplicate web content often exists without people knowing about it.

Most people see and as the same page, but search engines don’t—they see them as duplicate content. 

Google sees duplicate content as “appreciably similar” content in more than one URL. 

The major problem with duplicate content is that it’s difficult for search engines to decide on the version to include in the search index and rank for query results. 

This confusion could impact search engine rankings negatively.

But you could fix this by redirecting all non-www URLs to their www version, and thankfully, here’s how.

Redirecting Non-WWW URLs to WWW

You can create web redirects by adding some lines of code to your domain .htaccess file—a server configuration file that lets users make quick changes to their server settings. Use this code to redirect from non-www to www.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^ [NC]

RewriteRule ^(.*)$$1 [L,R=301]

Please replace on the code with your domain name and save the changes. 

Always add your redirect rules below the RewriteEngine On line, unless you have it already at the top of the .htaccess file. 

How to Redirect Non-WWW URLs to WWW?

If you do, then use the code without the RewriteEngine On line to create the URL redirect. 

RewriteCond %{HTTP_HOST} ^ [NC]

RewriteRule ^(.*)$$1 [L,R=301]

Now follow these steps to add the rule to your .htaccess file.

Step 1: Log into SPanel’s User Interface.

The default login URL is (don’t forget to replace with your actual domain).

How to Redirect Non-WWW URLs to WWW?

Step 2: Open the File Manager

Locate the FILES section on the homepage and click File manager.

How to Redirect Non-WWW URLs to WWW?

Navigate to your domain’s root directory in the file manager and open it.

If you’re setting up the redirect for your root domain, then the root directory should be the folder named public_html.

How to Redirect Non-WWW URLs to WWW?

If it’s for a subdomain or addon domain, choose the folder bearing its domain name.

Step 3: Add Your Code

Locate a file named .htaccess in the root directory, right-click the file to reveal a menu, then choose Edit to open the editor.

How to Redirect Non-WWW URLs to WWW?

Now, copy and paste your redirect rule into the editor and save. Then, type your URL without the www in your browser to confirm it’s redirecting to the www version.

Need Support?

If you need assistance creating this redirect, kindly reach out to our support for quick help, and we’ll be available to help.

Was this helpful?

Do you want to make your WordPress/WooCommerce site lightning fast?

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Just fill in the form below and we will get in touch with you.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Do you want to learn how to grow your website in 2023?

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. You will learn about:

  • What is the future of SEO and how you can be ahead of the curve
  • Web Design best practices and why they matter
  • Secrets to getting the foundation for your website to thrive

An Exclusive Insiders Look Behind The SEO and Web Development Curtain


Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.