[英]IIS rewrite change filename
我在论坛应用程序中有一些旧URL指向http://mydomain.tld/showthread.php?p=xxxx
,其中xxxx是整数ID。
我的新论坛应用程序使用viewtopic.php?p=xxxx
,我想使用IIS web.config重写规则来处理此问题。
我试图添加最后一条规则如下:
<rewrite>
<rules>
<rule name="Redirect www to non www" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<action type="Redirect" url="http://domain.tld/{R:1}" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain\.tld" negate="true" />
</conditions>
</rule>
<!-- this for change from showthread.php to viewtopic.php -->
<rule name="Rewrite" stopProcessing="true">
<match url="(.*)showthread\.php" />
<action type="Rewrite" url="viewtopic\.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
但是,它不能重定向到viewtopic.php
。 有什么建议吗?
我必须在IIS中启用httpRedirect 。 然后,在论坛根目录的web.config中使用了此重定向规则:
<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
<add wildcard="*showthread.php" destination="/viewtopic.php?$P" />
</httpRedirect>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.