urlwrite婚配问号
urlwrite匹配问号??? ????rule????????????from??^/article.asp\?id(.*)$?/?from????????????to??
urlwrite匹配问号?
?
? ???<?rule?>?
?????????<?from?>?^/article.asp\?id=(.*)$?</?from?>?
?????????<?to??type?="redirect"?>?/entry/$1.jhtml?</?to?>?
?????</?rule?>
???? 但是我这样的连接总是匹配不到,只要去掉那个?就可以了。这个正则表达式是没有问题的。/article.asp?id=64是可以匹配的到的。
??? 后来看3.0的manual (http://tuckey.org/urlrewrite/manual/3.0/)才发现原来是这个的问题。
<urlrewrite> element
The top level element.
AttributePossible ValueExplanationdefault-match-type?
(optional)regex(default)All rules and thier conditions will be processed using the Java Regular Expression engine (unless?
match-type
?is specified on a rule).wildcardAll rules and thier conditions will be processed using the?Wildcard Expression engine(unless?
match-type
?is specified on a rule).decode-using?
(optional)utf8(default)When URL is decoded UTF-8 will be used.nullDo not decode.[encoding]Any string representing a supported character encoding eg, ISO-8859-1. See?Java Charset Object?for more info.use-query-string?
(optional)false(default)The query string will?
not?be appended to the url that the "from" element matches against.trueThe query string will be appended to the url that the "from" element matches against.use-context?
(optional)false(default)The context path will?
not?be added to the url that the "from" element matches against.trueThe context path will be added to the url that the "from" element matches against.
就是那个use-query-string 的问题,默认的是不使用query-string就是把?后面的都忽略了。所以就不能匹配到了。只要在<urlrewrite>里面加一个属性就可以了。
<?urlrewrite??use-query-string?="true"?>?
????
</?urlrewrite?>