Link to home
Start Free TrialLog in
Avatar of arthurh88
arthurh88

asked on

IIS URL Rewrite syntax

I have a URL I want to rewrite:

A.  www.mysite.com/oldproducts   -->   www.mysite.com/master/default.aspx?state=all
B.  www.mysite.com/oldproducts/  -->  www.mysite.com/master/default.aspx?state=all

One has a trailing slash, the other doesn.t
How do I put this into a rewrite without using 2 rules?  This rule I have will work for A but doesn't work for B

<rule name="ProductsRoot" stopProcessing="true">
          <match url="^oldproducts/$" ignoreCase="true" negate="false" />
          <action type="Rewrite" url="master/default.aspx?state=all" appendQueryString="true" redirectType="Permanent"/>
        </rule>
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arthurh88
arthurh88

ASKER

that's perfect.  What does the question mark mean, may I ask?  Thanks!
https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx

? means 0 or 1 time for the item before it.:

EG oldproducts and oldproducts/
would it be better then to use /?$  to make sure nothing comes after the one or zero times of /
learned something new!  Thanks Kyle  :)