In this tutorial, we will show you how to use the non-WWW version of the website using .htaccess. By adding a few lines of code, you can easily redirect the www version to a non-www version of the website.

The final result will be ->

To avoid duplicate content issues, you should consider redirecting the www version to a non-www version of the website.

Steps to access and edit the .htaccess file in cPanel

Keep the cPanel / Hosting credentials ready and login to your cPanel account.

Step 1. Search for File Manager in cPanel.

Step 2. After opening the file manager, open public_html folder or the root directory of your website.

Step 3. In the top right corner of File Manager you’ll see Settings, click on that.

Step 4. Click the checkbox saying show hidden files.

Step 5. Now you’ll be able to see .htaccess file in your files.

Step 6. Do a right-click on the .htaccess file and hit the Edit button.

Step 7. Enter the code given below and save the file.


RewriteEngine On
RewriteCond %{HTTP_HOST}
RewriteRule (.*)$1 [R=301,L]

Just change the ‘domain’ in code with your domain name and you’re good to go!


This is the easiest way to redirect the www version of the website to a non-www version of your website. Let us know if you face any issues while redirecting. Users using our managed services can always open a support ticket for such help. Stay tuned for more easy tutorials.

Previous ArticleNext Article

Leave a Reply

Your email address will not be published. Required fields are marked *