请帮助我了解重写地图,我有以下设置:
<rewriteMap name="MyMap">
<add key="/pages" value="/website/pages/index.aspx" />
<add key="/pages/page-1" value="/website/pages/page-1/index.aspx" />
<add key="/pages/page-1/section-1" value="/website/pages/page-1/section-1.aspx" />
</rewriteMap>
这是我的规则:
<rule name="Rewrite rule for MyMap" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{MyMap:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" appendQueryString="true" />
</rule>
如果我尝试访问以下页面,则此方法有效:
- www.mydomain.com/pages(确定)
- www.mydomain.com/pages/page-1(确定)
- www.mydomain.com/pages/page-1/section-1(确定)
但是我希望可以在任何这些页面上添加查询字符串,例如:
- www.mydomain.com/pages?page=1(失败)
当我尝试访问此页面时,我得到404。如何使它工作?