0
我们已经通过tomcat rewrite.xml文件为java应用程序定义了url规则。对于tomcat的Url重写
<rule>
<condition name="host" operator="equal">example-laboratories.pt</condition>
<from>[^pt]/(.*)$</from>
<to type="redirect">http://example-laboratories.pt/pt/$1</to>
</rule>
当我们请求URL http://example-laboratories.pt URL,但我需要在用户请求http://example-laboratories.pt/pt重定向到http://example-laboratories.pt/pt这工作。现在上面的规则重定向到http://example-laboratories.pt/pt/pt(注意最后的附加'pt')。
我没有_quite_明白重写你想这样我就可以不建议解决方案,但肯定是一个正则表达式问题。 (来自''不符合你的期望...) –