article

Thursday, April 15, 2010

.htaccess: redirecting no www. to www.

.htaccess: redirecting no www. to www.

To redirect visitors from the www.-less domain we add the following code to our .htaccess file:



//Add the code to the .htaccess file

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^yourdomain.com [nc]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]

Related Post