Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Isapi rewrite

Status
Not open for further replies.

kevin197

Programmer
Mar 21, 2002
88
GB
Hi, I am trying to rewrite some urls on a windows server and if I can get my head round a basic one I should be ok writing the other rules I need.

The url I have is:

The url I am after is:


The code I have so far is:

Code:
<rewrite>
  <rules>
    <rule name="Rewrite to Level1.aspx">
      <match url="^Level1.aspx?Grp1Code=([0-9]+)Grp1Desc=" />
      <action type="Rewrite" url="{R:1}" />
    </rule>
  </rules>
</rewrite>
 
I don't know what kind of regex interpreter you are using, but the one you have there won't match your sample input data. For starters, question marks are usually special characters, but since this appears to be built for use with URLs, they may not be here. You also don't have anything to match the ampersand.

I'd try something like this
Code:
url="^Level1.aspx\?Grp1Code=([0-9]+)&Grp1Desc=([a-zA-z0-9_]+)"

And then the second part (the keyword, as you called it) would be accessible as the second variable returned from the expression. In Perl it would be $2.
 
Thanks for that, that makes sence.

I'm using the ISAPI_Rewrite on from Helicon Tech

So as I see it my code should be:

Code:
<rewrite>
  <rules>
    <rule name="Rewrite to Level1.aspx">
      <match url="^Level1.aspx\?Grp1Code=([0-9]+)&Grp1Desc=([a-zA-z0-9_]+)" />
      <action type="Rewrite" url="{R:2}" />
    </rule>
  </rules>
</rewrite>
 
I think the match is correct now. I'm looking through the docs on the page you linked, but I'm not seeing any examples that match yours exactly, so I don't know about the action tag.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top