[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

IIS rewrite issue. I cannot get the query_string to match

What is wrong with this IIS rewrite rule?  I cannot seem to get it to work. If I remove the query string condition it works as expected.

<rule name="Rule 495" stopProcessing="true">
				<match url="^golfbooking/golfbook.aspx$" ignoreCase="true" />
				<conditions>
				<add input="{QUERY_STRING}" pattern="PackName=Tee+Times+Only&amp;PackNew=TRUE&amp;hdr=pmb" />
				</conditions>
				<action type="Redirect" url="https://www.mbgolf.com/golfbooking/teetimesonly.htm" redirectType="Permanent" />
				</rule>

Open in new window

0
rjohnsonjr
Asked:
rjohnsonjr
  • 3
  • 2
1 Solution
 
Dan McFaddenSystems EngineerCommented:
If you are only looking for this exact query string on the golfbook.aspx page, you could try an exact match rule:

<rule name="Tee Time Only" patternSyntax="ExactMatch">
    <match url="golfbooking/golfbook.aspx?PackName=Tee+Times+Only&amp;PackNew=TRUE&amp;hdr=pmb" />
    <action type="Rewrite" url="https://www.mbgolf.com/golfbooking/teetimesonly.htm" appendQueryString="false" redirectType="Permanent" />
</rule>

Open in new window


If there additional query string variable attached to the request, you will have to account for those as well.

Dan
0
 
rjohnsonjrAuthor Commented:
That doesn't work.  Something with that query string has to be causing an issue...
0
 
rjohnsonjrAuthor Commented:
I had to escape the + signs

<rule name="Rule 495" stopProcessing="true">
				<match url="^golfbooking/golfbook.aspx$" ignoreCase="true" />
				<conditions>
				<add input="{QUERY_STRING}" pattern="PackName=Tee\+Times\+Only&amp;PackNew=TRUE&amp;hdr=pmb" />
				</conditions>
				<action type="Redirect" url="https://www.mbgolf.com/golfbooking/teetimesonly.htm" redirectType="Permanent" />
				</rule>

Open in new window

0
 
Dan McFaddenSystems EngineerCommented:
Ah, I didn't even think of that.  Good catch.
0
 
rjohnsonjrAuthor Commented:
This was the solution that I implemented
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now