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: Rewriting the HTTP_HOST
Author
Message |
syphon
Newbie


Joined: 31 May 2011
Posts: 2
Posted: 31 May 2011 at 7:16pm

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
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 01 June 2011 at 2:17am

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
 

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