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
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Problem: convert .htaccess to httpd.ini Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
xx7879
Newbie
Newbie


Joined: 20 July 2011
Online Status: Offline
Posts: 1
Posted: 20 July 2011 at 12:13pm | IP Logged Quote xx7879

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 View xx7879's Profile Search for other posts by xx7879
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 8119
Posted: 25 July 2011 at 4:40am | IP Logged Quote Lexey

Try this:

RewriteCond Host: (?!www\.)(.*)
RewriteCond METHOD GET|HEAD
RewriteRule (.*) http\://www.$1$2 [I,RP]
Back to Top View Lexey's Profile Search for other posts by Lexey
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
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