我想使用 IIS7 的 URL 重写模块根据特定模式创建 301 重定向。
我有一个仅包含 .HTML 文件的网站。我正在将该网站转换为 .PHP 文件,但保留所有相同的文件名。例如,以下网址...
/index.html
/contact/contact.html
/membership/member.html
会变成...
/index.php
/contact/contact.php
/membership/member.php
任何人都可以建议如何创建此规则吗?
Thanks.
干得好:
<system.webServer>
<rewrite>
<rules>
<rule name="html2php" stopProcessing="true">
<match url="^(.+)\.html$" />
<action type="Redirect" url="{R:1}.php" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
在 IIS 7.5 上使用 URL 重写模块 v2.0 进行测试 - 工作正常。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)