I'm adding some URL rewrite rules on my IIS so it redirects an old URL to a new location.
It works when the URL has only one query string parameter, but if I have more than one it does not work. Is there anything I can do so I can get the second parameter if it exists and if not just get the first one?
Here is my web.config rule.
<rule name="Rewrite rule1 for viewtopic.php" stopProcessing="true">
<match url="^.*(?:viewtopic.php).*$.*" />
<conditions>
<add input="{QUERY_STRING}" pattern="^t=/name=([0-9]*)/" />
</conditions>
<action type="Redirect" url="https://example.com/view/{C:1}/topic" appendQueryString="false" redirectType="SeeOther" />
</rule>
The rule will work if my URL is like this. https://example.com/viewtopic.php?t=123456
Now I do have some old URLs that is formatted like this https://example.com/viewtopic.php?t=123456&highlight=Welcome
in this case when the IIS rule runs it gives me the following redirect URL https://example.com/view/123456&highlight=Welcome/topic and I'm trying to make the URL to be like this: https://example.com/view/123456/topic