How to Redirect Non-WWW URLs to WWW?

Duplicate web content often exists without people knowing about it.

Most people see https://www.domain.com and https://domain.com 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} ^domain.com [NC]

RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

Please replace domain.com 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} ^yourdomain.com [NC]

RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

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

Step 1: Sign in to Your SPanel Account

Log in to your account control panel using your email (or username) and password.

Visit www.domain.com/spanel/login on your computer to open your SPanel account login page. 

How to Redirect Non-WWW URLs to WWW?

If you log in as a super admin, Spanel takes you to the admin dashboard first but logs you straight to your account’s control panel if you sign in as a user.

Step 2: Choose your Account 

To access your control panel from the admin dashboard, click List Accounts under the QUICK LINKS section.

How to Redirect Non-WWW URLs to WWW?

Pon your accounts lists, please scroll to the account you wish to log into its control panel.

How to Redirect Non-WWW URLs to WWW?

Click the Actions button to reveal a drop-down menu, then choose Login to access the account’s control panel.

How to Redirect Non-WWW URLs to WWW?

Step 3: Open File Manager

Locate the FILES section on the control panel and click File manager.

How to Redirect Non-WWW URLs to WWW?

Kindly locate your domain’s root directory in the file manager and open the folder.

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.

Rado

Author

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.

Write a Comment

Required*