我正在尝试使用java网页上的urlrewritefilter制作友好的URL。
首先,我做了这个:
<!-- redirects url.com/something -->
<rule>
<from>^/([a-z]+)$</from>
<to>/motor/index.jsp?empresa=$1</to>
</rule>
<!-- redirects url.com/something/ -->
<rule>
<from>^/([a-z]+)/$</from>
<to>/motor/index.jsp?empresa=$1</to>
</rule>
但是,当我尝试添加其他规则时,它不起作用。我尝试输入的任何网页都会导致此错误:
org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)
这些是我尝试介绍的其他规则:
<!-- redirects url.com/(numbers) -->
<rule>
<form>^/([0-9]+)$</form>
<to>/motor/login.jsp</to>
</rule>
<!-- redirects url.com/start-sesion -->
<!-- This is the rule I want to get working. The previous rule was just a test -->
<rule>
<form>^/start-sesion$</form>
<to>/motor/login.jsp</to>
</rule>
任何方式。这些规则都不起作用。
有些想法? :P