开发者

why tuckey UrlRewriteFilter outbound-rule mapping did not work?

开发者 https://www.devze.com 2022-12-22 00:07 出处:网络
I\'m using urlrewritefilter to pretty up my product links for a better google indexing (removing product parameter).

I'm using urlrewritefilter to pretty up my product links for a better google indexing (removing product parameter).

example:

.../product/snowboarda

i开发者_开发技巧s transferred via url rewriting rule to

.../product.seam?product=snowboarda

rewriting rule

<rule>
   <from>^/product/([a-zA-Z]+)$</from>
  <to>/product.seam?product=$1</to>
</rule>

But my problem is that I've no idea at the moment how to rewrite outbound links in my facelets. I read the paragraph about outbound-rule in the in the manual. Now I'm wondering how I can use this together with s:link? what about form submits or redirects (action outcome null)? please help to sort things out :)

possible rewriting outbound rule (?)

<outbound-rule>
 <from>^/product.seam?product=([a-zA-Z]+)$</from>
 <to>/product/$1</to>
</outbound-rule>

any hints/ideas?


I had the same problem and solved by escaping the ? character. It's a special regex character so you have to escape it with a \.


I had the same problem and solved it removing the caret at the beginning

<outbound-rule>
   <from>/product.seam?product=([a-zA-Z]+)$</from>
   <to>/product/$1</to>
</outbound-rule>

(Also, I'm not sure if you should try escaping the question mark symbol with \?)

0

精彩评论

暂无评论...
验证码 换一张
取 消