Smartest Method to Redirect non-WWW URLs to WWW

December 22, 2021 / cPanel & WHM

We will discuss the best technique for redirecting non-WWW URLs to the WWW in this post.

1. Use your email (or login) and password to access your root account.

This image has an empty alt attribute; its file name is Screenshot_1.png

If you log in as a super admin, cPanel sends you to the admin dashboard first, but if you join in as a user, Spanel takes you directly to your account’s control panel.

2. Click List Accounts from the admin dashboard to go to your control panel.

This image has an empty alt attribute; its file name is Screenshot_4.png

3. Please browse through your account listings until you find the account for which you want to log into the cPanel account.

This image has an empty alt attribute; its file name is download-1024x176.png

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

5. Open the File Manager program, Click File manager in the FILES section of the control panel.

This image has an empty alt attribute; its file name is Screenshot_4-1.png

In the file manager, look for your domain’s root directory and open it.

6. If you’re putting up a redirect for your main domain, the root directory should be the public_html.

This image has an empty alt attribute; its file name is Screenshot_4-2.png

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

8. Now, copy and paste your redirect rule into the editor and save.

And, to redirect from a non-www URL to a www URL, add the below code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com 
RewriteRule (.*) https://www.yoursite.com/$1 [R=301,L]

Save the .htaccess file.

After that, type your URL without the www in your browser to confirm it’s redirecting to the www version.

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

Also Check: How to Set Up Redirects in cPanel

If you need a more powerful web hosting solution to cope with increasing demand, visit our homepage.

Spread the love