This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Redirect non www to www
Author
Message |
kotagiri
Newbie


Joined: 10 November 2011
Posts: 1
Posted: 10 November 2011 at 2:16pm

Hi I am looking to redirect the users who come on to my site with a non www to a www.

I created a rule like this

    RewriteCond %{HTTP:Host} ^(?!.mysite.com)(.+)$ [NC]
    RewriteCond %{REQUEST_URI} (.+)
    RewriteRule (.*) http(?%1s)://www.mysite.com/$1 [R=301,L]

But this doesn't work.

Can anyone help.

Thanks,

Partha
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 14 November 2011 at 6:10am

Hello Partha,

Here's a common rule for that thing:

Code:
RewriteEngine on

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]


Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version