1

I am using IIS 8 and just learning about rewrites as I haven't ever written anything that cared about SEO.

I have the following rules that is working assuming the url looks like this: /survey/abc123/email

<rule name="Survey Rule" stopProcessing="true">
    <match url="survey/([_0-9a-z-]+)/([_0-9a-z-]+)" />
    <action type="Rewrite" url="survey.htm?var1={R:1}&amp;var2={R:2}" />
</rule>

On the survey.htm page I have code that check for existance of var1 & var2 but in this rewrite if I have the url /survey/abc123 it doesn't obiously hit the Survey Rule. I have tried a couple of <conditions> but could find the right one.

I feel there must be a way to say

If {R:1} exists then var1={R:1} else var1=''

If {R:2} exists then var2={R:2} else var1=''

Ideally some type if loop. Is there any way to do this in a rewrite to that no matter how many / there are after survey, whether 0 or 10 it will always it the survey page?

Lance
  • 111
  • 4

0 Answers0