views:

77

answers:

1

I am using Tuckeys UrlRewrite filter for getting clean urls on my java application. I redirect all the requests to a certain resource to a spring request dispatcher. Here is my original rule

<rule>
   <from>(.*)$</from>
   <to>$1.htm</to>
</rule> 

Problem is that accessing .js, .css files also seem to be redirecting. I want to know how to write a rule with a negation for any extensions. So the rule should match all single words (like login, logout) and not match for words with extensions (like login.jsp, image.jpg, sc.js ).

+1  A: 

You can add a <condition> element where you disallow certain paths to be rewritten:

<rule>
   <condition type="request-uri" operator="notequal">\.[a-z]+$</condition>
   <from>(.*)$</from>
   <to>$1.htm</to>
</rule> 
Martin
Awesome!! it worked!!
Ritesh M Nayak