301 Redirect Mod_Rewrite
Feb 22nd, 2008 by Leonard Ghazarian |
Email This Post
|
Print This Post
Every website should have this implemented. It forces your site to always show the triple w’s before your domain.
This prevents search engines from indexing your site twice and showing duplicate content, which could have a negative impact in your page ranking.
Options +FollowSymLinks
RewriteEngine onRewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RewriteEngine onRewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
Add the above code to your .htaccess file, make sure you replace the domain.com with your actual domain name.

