views:

124

answers:

2

I have a question about using htaccess in my litespeed server. I tried to redirect http://domain.com to http://www.domain.com using this rule:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule .* http://www.domain.com/ [L,R=301]

When I check http://domain.com using Xenu, the result is as follow:

http://domain.com/   200 ok text/html 301 Moved Permanently 
http://domain.com/%s  200 ok text/html 301 Moved Permanently  
http://www.litespeedtech.com/ 200 ok text/html LiteSpeed Web Server 
http://www.domain.com/         200 ok text/html redir 

I wonder whether I had incorrect htaccess rule or this is because of bug in litespeed? I have searched anywhere for hours...Thanks

A: 

You can redirect non-www subdomains to the www subdomain with this rewrite:

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

@mipadi: I guess it is not 301 redirected (or is it?). Here is what I got from Xenu:

http://domain.com/   200 ok text/html Homepage
http://cdn.domain.com/css/style.css  200 ok text/css
http://www.domain.com/about/         200 ok text/html About
http://www.domain.com/contact/         200 ok text/html Contact
webdev28
No one can answer this?
webdev28