我正在使用带有URL重写的IIS 7.5。
我在网上有旧的遗留网址,指向这样的网址:
http://www.domain.com/games/dog-vs.-cat
http://www.domain.com/games/john.smith-ran-away
我需要在没有点的情况下重写这些网址:
http://www.domain.com/games/dog-vs-cat
http://www.domain.com/games/johnsmith-ran-away
这是我的规则无效。
<rule name="RedirectOldURL" stopProcessing="true">
<match url="^games/([a-zA-Z0-9-]+)$" />
<action type="Redirect" redirectType="Permanent" url="/games/{R:1}" />
</rule>
是否可以在没有点的情况下重写源URL?点可以出现在最后一段网址中的任何位置。
由于
答案 0 :(得分:0)
在行动中使用
<match url="^games/([0-9]+)/([_0-9a-z-]+)" />
并在行动中使用:
url="games.aspx?id={R:1}&title={R:2}"