How to redirect WWW to Non-WWW with htaccess

How to redirect WWW to Non-WWW with htaccess

If you want that all of your traffic moves to non-www version of your website then you will need to insert a piece of code into your htaccess file in public_html folder. Choosing one from www or non-www version of your website is good for SEO.

Redirct WWW to Non-WWW with .htaccess

1. Login to cPanel and go to File Manager.
2. Go to Public_html folder > edit .htaccess file and insert this piece of code into it:

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

3. Change example.com to your own domain name and save the file.

That’s it, now all of your visitors will be seeing non-www version of your website no matter if they type www.example.com or just example.com.

Copyright © 2014-2018 Webxen.com. All rights reserved.