[英]IIS URL Rewrite Module root directory mapping
I am using the URL Rewrite Module on IIS 8. 我在IIS 8上使用URL重写模块。
I want to be able to map all calls to *.archive to a page handler which does work using the following code 我希望能够将所有对* .archive的调用映射到使用以下代码工作的页面处理程序
<rule name="Redirect .archive extension" stopProcessing="true">
<match url="^(.*).archive" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(.*).archive$" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="PageHandler.ashx?path={C:1}" />
</rule>
I now need to map calls to directories / paths to the same handler where a default file is not specified eg 我现在需要将对目录/路径的调用映射到未指定默认文件的同一处理程序,例如
https://www.example.com
https://www.example.com/images
https://www.example.com/images/
Does anyone have any example about how I can achieve the above and keep my archive rule? 有没有人有任何关于如何实现上述目标并保持存档规则的示例?
Thanks Mark 谢谢马克
You could use below rewrite rule: 您可以使用以下重写规则:
<rule name="Redirect .archive extension" stopProcessing="true">
<match url="www.sample1.com/(.*)" ignoreCase="true" negate="true" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_URI}" pattern="(.*)" />
</conditions>
<action type="Rewrite" url="page1.html?path={C:1}" appendQueryString="false" logRewrittenUrl="true" />
</rule>
Note: Modify hostname and rewrite url as per your requirement. 注意:根据您的要求修改主机名并重写url。
Regards, Jalpa 此致贾尔帕
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.