Sunday, September 26, 2010

Rewrite condition for domain.com to www.domain.com using HTACCESS

Redirecting from domain.com to www.domain.com is mostly helpful as part of SEO. The rule for rewriting the site is shown below.

rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Just change the domain name to your site name to use the rewrite rule.

  

No comments: