IIS7 URL 重写模块替换 [英] IIS7 URL Rewriting Module Replace
本文介绍了IIS7 URL 重写模块替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我真的很喜欢 IIS7 URL 重写模块,到目前为止,它对我来说效果很好.
I really like the IIS7 URL rewriting module and so far, it worked great for me.
有一件事我不知道该怎么做:我想将所有包含编码空格 (%20) 的 URL 永久重定向到一个将空格替换为破折号 (-) 的 URL.
There is one thing that I'm not sure how to do: I would like to permanently redirect all URLs that have encoded spaces (%20) in them to a URL that has the spaces replaced with a dash (-).
所以:
http://www.test.com/About%20Our%20Mission.aspx
应该重定向到这个:
http://www.test.com/About-Our-Mission.aspx
仅使用正则表达式就可以吗?
Is that even possible with only regular expressions?
推荐答案
没有办法直接做你想做的事.
There's no way to do directly what you want.
你可能会满足于这样的事情:
You might settle for something like this:
^(.*)%20(.*)%20(.*)%20(.*) replaced by: {R:1}-{R:2}-{R:3}-{R:4}
^(.*)%20(.*)%20(.*) replaced by: {R:1}-{R:2}-{R:3}
^(.*)%20(.*) replaced by: {R:1}-{R:2}
这篇关于IIS7 URL 重写模块替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文