[英]Premanently redirect .php or .aspx to an extensionless asp.net MVC page
thought the following was working but it turns out not to. 认为以下内容有效,但事实并非如此。 I want to redirect the following pages for example. 例如,我想重定向以下页面。 The original site was php then moved to aspx and now mvc. 原始站点是php,然后移到了aspx,现在移动到了mvc。
http://www.example.com/page/one.aspx http://www.example.com/page/one.aspx
http://www.example.com/page/one.php http://www.example.com/page/one.php
to 至
http://www.example.com/page http://www.example.com/page
The IIS Rewrite rile that I created is below but it needs tweaking. 我创建的IIS Rewrite Rile在下面,但需要进行调整。
<rule name="PHPToASPNET" stopProcessing="false">
<match url="(.*)\.php$" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" negate="true" pattern="\.axd$" />
<add input="{URL}" negate="true" pattern="\.xml$" />
<add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="http://www.example.com/{ToLower:{R:1}}" redirectType="Permanent" /
Try this 尝试这个
<rule name="PHPToASPNET" stopProcessing="true">
<match url="^(.*)/(.*)\.(php|aspx)$" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" negate="true" pattern="\.axd$" />
<add input="{URL}" negate="true" pattern="\.xml$" />
<add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>
<action type="Redirect" url="http://www.example.com/{ToLower:{R:1}}" redirectType="Permanent" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.