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: Rewriting the HTTP_HOST Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
syphon
Newbie
Newbie


Joined: 31 May 2011
Online Status: Offline
Posts: 2
Posted: 31 May 2011 at 7:16pm | IP Logged Quote syphon

I'm trying to rewrite the host header for our test lab. Here's my code:
Code:
RewriteCond %{HTTP_HOST} ^(.*)\.(\w+)\.webtester\.net(.*)
RewriteRule /(.*) http://%2/$1 [R]
What this is trying to do... is rewrite
"http://www.sitename.com.SERVERNAME.webtester.net/any_old_junk.htm" into "http://SERVERNAME/any_old_junk.htm". However, when I use Fiddler, I see
that I'm getting 302'd to "http://%2/any_old_junk.htm" (somehow my backreference isn't getting defined).

Anyone have any ideas what's going on here? I've tested my regex and it seems ok. I have no idea why this thing isn't working, so any help would
be greatly appreciated!
Back to Top View syphon's Profile Search for other posts by syphon
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 01 June 2011 at 2:17am | IP Logged Quote Anton

The problem is because ISAPI_Rewrite v2 uses slightly different syntax:

RewriteCond %{HTTP_HOST} (.*)\.(\w+)\.webtester\.net
RewriteRule (.*) http\://$1$2 [R]

All parentheses related to the rule (starting with Conds) are labelled $1...$9 (there's no %N enumeration for Conds in v2).

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 

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