Regex IIS7 301重定向正则表达式以用连字符替换下划线
我正在寻找一些帮助,使用正则表达式在IIS7上进行301重定向 我有一些链接指向像这样的页面,我希望将这些文件重命名为使用连字符而不是下划线 我可以使用以下方法逐一完成此操作:Regex IIS7 301重定向正则表达式以用连字符替换下划线,regex,redirect,iis-7,http-status-code-301,Regex,Redirect,Iis 7,Http Status Code 301,我正在寻找一些帮助,使用正则表达式在IIS7上进行301重定向 我有一些链接指向像这样的页面,我希望将这些文件重命名为使用连字符而不是下划线 我可以使用以下方法逐一完成此操作: <location path="colour-photo-copying.html"> <system.webServer> <httpRedirect enabled="true" destination="colour_photo_copying.html" ht
<location path="colour-photo-copying.html">
<system.webServer>
<httpRedirect enabled="true" destination="colour_photo_copying.html" httpResponseStatus="Permanent" />
</system.webServer>
</location>
唯一的问题是我几乎没有这些,我希望写一个正则表达式规则,但不知道如何做到这一点
我看到了这一页:但这并不是我所希望的
有没有regex的人来帮忙
非常感谢您的建议。好的,我找到了这个解决方案,并想与大家分享一下,以防其他人寻找它
<rewrite>
<rules>
<rule name="replace underscore with hyphen" stopProcessing="true">
<match url="^(.*)_(.*).*$" ignoreCase="false" />
<action url="/{R:1}-{R:2}" type="Redirect" />
</rule>
</rules>
</rewrite>
如果有人觉得他们可以改进,请告诉我
谢谢,
贾斯