rewrite redirect issue in debian squeeze

Posted by hd01 on Server Fault See other posts from Server Fault or by hd01
Published on 2012-06-12T08:42:17Z Indexed on 2012/06/12 10:41 UTC
Read the original article Hit count: 274

My server os is debian squeeze. I have these lines to redirect non-www to www in htaccess file of my website:

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

but it cause this error in firefox:

  The page isn't redirecting properly

  Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

  This problem can sometimes be caused by disabling or refusing to accept
cookies.

when I comment those lines in htaccess mysite appears but in non-www format. I'm sure it works well before on the Ubuntu . but I don't know why it doesn't work now. would you help me?

© Server Fault or respective owner

Related posts about .htaccess

Related posts about mod-rewrite