I have a url rewrite rule that uses map method.
<rewriteMap name="Pages">
<add key="/search" value="/search.asp" />
</rewriteMap>
<rule name="Rewrite rule1 for Pages">
<match url=".*" />
<conditions>
<add input="{Pages:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="true" />
</rule>
My problem is when I use this page like below, I get error:
/search?keyword=math
I get HTTP Error 404.0 - Not Found
Detailed Error Information: Module IIS Web Core Notification MapRequestHandler Handler StaticFile Error Code 0x80070002 Requested URL http://localhost:85/search?keyword=math Physical Path D:\webs\V5ST\HTML\search Logon Method Anonymous Logon User Anonymous
How can I make this so that whatever querystring is passed to search.asp?
You could use below rewrite rule:
<rule name="query string redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{REQUEST_URI}" pattern="search\?(.*)" />
</conditions>
<action type="Rewrite" url="http://localhost:132/search.asp?{C:1}" appendQueryString="false" />
</rule>
Regards, Jalpa
User contributions licensed under CC BY-SA 3.0