Htaccess redirect from www domain to non-www domain

Posted on August 3, 2013 at 7:53 pm

Permamently redirect all users that visit the www domain to the non-www domain. In short, remove the “www” from the domain using mod_rewrite and .htaccess file.

Write this text in your .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.tld$ [NC]
RewriteRule ^(.*)$ http://domain.tld/$1 [R=301,L]

Updated on October 22, 2013 at 3:53 pm

Receive updates via email

Other Posts

Updated Posts