【发布时间】:2013-02-06 08:07:21
【问题描述】:
我是使用 URL 重写模块的新手,但我对论坛线程的简单 URL 重写遇到了麻烦(使用 IIS 7.5)
我需要重写:
/forum/100/2534/friendly-title
或:
/forum/100/2534/334/comment/friendly-thread-title
到:
/forum/?forum=100&thread=2534&post=334&postType=comment
我写的规则(不起作用)是:
^forum/([1-9][0-9][0-9]*)/([1-9]*)/(([1-9]*)/(post|comment)/)?([a-zA-Z0-9-]{5,50})$
映射到:
/forum/?forum={R:1}&thread={R:2}&post={R:4}&postType={R:5}
我收到 404 错误。
【问题讨论】:
-
我测试了正则表达式,它执行了所有值,尽管当我尝试映射第一种类型的友好 URL 时,R:4 和 R:5 为 NULL。
标签: iis iis-7 url-rewriting iis-7.5