January 28, 2012

redirect domain.com to www.domain.com using .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]

1 comment:

  1. I using this code :

    RewriteCond %{HTTP_HOST} !^www\.domain\.com (or ^domain\.com)
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

    but I dont know about R=301.. & L

    ReplyDelete