Remove www. from url with htaccess

In order to remove www. from the url you can add the following lines to your .htaccess file.



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

This will redirect all www.yourdomain.com to http://yourdomain.com

Created on : 2017/01/20 - Last updated on : 2017/01/20

Back