This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Problem: convert .htaccess to httpd.ini
Author
Message |
xx7879
Newbie


Joined: 20 July 2011
Posts: 1
Posted: 20 July 2011 at 12:13pm

Hello,

I just moved my website from linux to Windows server 2003 (IIS 6.0).
My rewrite rules will redirect URL without www into www.domain.com.
They works good in Linux (in file .htaccess):

#Redirect non-www to www
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L]

But I can't get it work in IIS ( in file httpd.ini).
The Windows server config should be good, because I also have other URL rewrite rules, they work great, except this rule (non-www to www).

Who can help to convert it? Thanks
Back to Top
 
Lexey
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Posts: 8119
Posted: 25 July 2011 at 4:40am

Try this:

RewriteCond Host: (?!www\.)(.*)
RewriteCond METHOD GET|HEAD
RewriteRule (.*) http\://www.$1$2 [I,RP]
Back to Top
 

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

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum