I have some page about.jsp, contact.jsp, user.jsp, index.jsp in a folder projects under webapps root. I use tuckey-urlrewrite-filter for url mapping. I used url writing as
<rule>
<from>/contact_us</from>
<to>/contact.jsp</to>
</rule>
<rule>
<from>/about_us</from>
<to>/about.jsp</to>
</rule>
When I type in url about_us or contact_us these are finely work to open the corresponding page. But I want url for user.jsp any thing except contact_us and about_us. Because I used user.jsp as profile page. If in url I type "abhiramgiri" user.jsp should open or anything I type except contact_us and about_us it should open user.jsp. I am not able to write the actual code for these case. Plz help me...
Try setting last="true" to your first two rules, then adding a third rule:
<rule>
<from>/contact_us</from>
<to last="true">/contact.jsp</to>
</rule>
<rule>
<from>/about_us</from>
<to last="true">/about.jsp</to>
</rule>
<rule>
<from>.*</from>
<to>/user.jsp</to>
</rule>
This means that, if there is a match on /contact_us then the filter will stop looking for matches, and the same goes for /about_us. Anything that doesn't match either of those will be compared against the third rule, which should match anything.
In regular expressions, "." means match any single character, and "*" means match zero or more occurrences of the preceding portion of the pattern. So ".*" means match zero or more of any character.