我在iis url重写模块中使用+(加上添加)字符时遇到问题。
我需要改写:
http://www.example.com/search/test1+test2
在
http://www.example.com/search/?q=test1+test2
Url重写模块基本解决方案不起作用并抛出404错误:
模式: ^搜索/([^ /] +)/?$
重写网址:搜索/?q = {R:1}
=============================
我尝试添加另一个参数,但我再次抛出404错误:
模式: ^搜索/([^ /] +)\ +([^ /] +)/?$
重写网址:搜索/?q = {R:1} + {R:2}
=============================
这个替代解决方案例如有效:
模式: ^搜索/([^ /] +) - ([^ /] +)/?$
重写网址:搜索/?q = {R:1} + {R:2}
有什么问题?
提前致谢
答案 0 :(得分:1)
我认为你不需要开头的^
模式:search/([^/]+)/?$
重写网址:search/?q={R:1}