How to redirect www URLs to non-www?
You can redirect all of the requests for www.yourdomain.com domain to yourdomain.com by modifying your website’s .htaccess file. You have to add the following lines in the beginning of the file so that the redirection is properly set up:
1
2
3
|
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
|
You should replace yourdomain.com with your actual domain name.
You can edit the .htaccess file using the File Manager in cPanel or via FTP.
From now on, when someone access http://www.yourdomain.com that visitor will be redirected to http://yourdomain.com.