我正在使用 tuckey url 重写过滤器,我想将语言扩展名 (.cfm) 添加到干净的 url。 (我知道我假设路径中的最后一个词始终是脚本。)
比如我想把.cfm加到
/someScript
/module/employee/anotherScript
并且显然不是已经具有扩展名的路径(定义为具有句点)
/someScript.cfm
/module/employee/anotherScript.cfm
这是我想到的正则表达式规则:
<rule>
<from>^((?!\.)[\w/])*$</from>
<to type="redirect" last="true" qsappend="true">$0.cfm</to>
</rule>
问题来了。我还想允许一个可选的尾部斜杠,以便删除斜杠并添加文件扩展名。
/someScript/
/module/employee/anotherScript/
如何重写我的正则表达式规则以忽略可选的尾部斜线?
最佳答案
关于regex - 使用 Tuckey URL Rewrite 添加文件扩展名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27920218/