Problem to redirect non-www to www

Problem to redirect non-www to www

Postby easyexpat on Wed Jun 30, 2010 6:01 am

I have problems with redirecting non-www to www url.

On one of the websites I would like http://blogexpat.com to redirct to http://www.blogexpat.com and also all others such as http://blogexpat.com/fr/index.htm to http://www.blogexpat.com/fr/index.htm

(lifetype is installed here: http://www.blogexpat.com/en/summary.htm with RewriteRule ^en/summary.htm summary.php?lang=en_UK [L])

I tried:
Code: Select all
# Force to write www in url
RewriteCond %{HTTP_HOST} ^blogexpat.com$
RewriteRule ^(.*)   http://www.blogexpat.com/$1  [QSA,L,R=301]


but it does not work as it displays:
Oops! Firefox could not find blogexpat.com
Suggestions: ...


Can you tell me what's wrong?

How can I make that all http://blogexpat.com/$1 go to http://www.blogexpat.com/$1 :?:
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm

Re: Problem to redirect non-www to www

Postby jondaley on Wed Jun 30, 2010 5:40 pm

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.domain.com/$1 [L,R=permanent]
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Configuration and Installation