Admins eHow SysAdmin Tips & Tricks

May 7, 2009

Redirect 301 domain.com to www.domain.com using mod_rewrite

Filed under: General — Tags: , , , , — admin @ 9:10 am

For SEO improvements you may want to create a permanent redirect (301) from your domain.com to www.domain.com.
you can do it easily using Apache mod_rewrite , simply open .htaccess file in the root directory of your website and add the following lines to it :

Options +FollowSymLinks
RewriteEngine On
rewritecond %{http_host} ^domain.com [NC]
rewriterule ^(.*)$ http://www.domain.com/$1 [R=301,NC,L]

it will do the trick for you 🙂

Powered by WordPress