htaccess rewrite www
i wish i could use all linux, apache, mysql, php servers for all my projects. things are just way easier than using iis. i love using this block of code in my htaccess file to redirect non www domains to www-domains.
first why is this important. the biggest reason is google and other search engines see both links as actually different websites with the same content. so if you redirect http://example.com to http://www.example.com google knows its only one site and you avoid duplicate content issues.
so in your .htaccess file just add the following code [obviously switch our “example.com” with your domain in the two spots shown below]…
########## Begin non www 301 to www redirect
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Matt is a Systems Development Director for a multinational franchise. Matt has lived and worked in Hawaii, Chicago, South Florida and currently resides outside of Atlanta. He enjoys his hobbies including Technology, Gadgets/EDC, Fountain Pens, Wetshaving, Clocks, Antiques & Coffee. He even roasts his own coffee weekly.