Question

Im using a J2ee application with spring framework 2.0 on a apache tomcat 5.5.

I have used URL mapping to change the extension from .jsp to .htm. I have an URL which looks like this localhost:8080/promotion.htm?cid=12345.

I want to change it to localhost:8080/12345

Can someone please help me out in writing a rule which will perform the required rewrite in urlrewrite.xml using tuckey URL rewrite filter

This is what I have mentioned in web.xml

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewrite Filter</filter-class> </filter>

All I need is the URL to change to http://localhost:8080/12345. I do not want any redirection to happen. All I need is a clean URL so that the URL looks neat. I have tried quite a lot of rules myself but to no success.

How can this be done?

Was it helpful?

Solution

After a long time with no replies/comments I achieved this myself with the following rule in the urlrewrite.xml

 <rule>
 <from>/([a-zA-Z0-9]{1,}$)</from>
    <to >/promotion.htm?cid=$1</to>
</rule>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top