我正在尝试使用更具描述性的 URL 来重定向一些不友好的 URL。这些 URL 结尾为.aspx?cid=3916
每个类别名称页面的最后一位数字都不同。我希望它重定向到Category/CategoryName/3916
。我在web.config
file:
<location path="Category.aspx?cid=3916">
<system.webServer>
<httpRedirect enabled="true" destination="http://www.example.com/Category/CategoryName/3916" httpResponseStatus="Permanent" />
</system.webServer>
</location>
但由于它不仅仅以扩展结束,所以它不起作用。有没有一种简单的方法可以让它发挥作用?我使用的是 IIS 7.5。
-
Open web.config
在目录中旧页面所在的位置
-
然后为旧位置路径和新目的地添加代码,如下所示:
<configuration>
<location path="services.htm">
<system.webServer>
<httpRedirect enabled="true" destination="http://example.com/services" httpResponseStatus="Permanent" />
</system.webServer>
</location>
<location path="products.htm">
<system.webServer>
<httpRedirect enabled="true" destination="http://example.com/products" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
您可以根据需要添加任意数量的位置路径。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)