I am setting URL rules using Tuckey UrlRewrite. Everything to work so far, however I am struggling with my default page.
Purpose: - any request that does not match an existing file; or - Any query that does not comply with the previous rules ... should start a search through search.jsf?q= . It is designed to handle any possible dead link from the old site and to replace a 404 page with something more functional (to help the user find what he is actually looking for).
Partial code (other rules are similar to the second, only the default rule will fail):
<rule> <name>Home</name> <from>^/$</from> <to type="forward" last="true">/home.jsf</to> </rule> <rule> <name>Contact Us</name> <from>^/contact_us/?$</from> <to type="forward" last="true">/contactUs.jsf</to> </rule> <rule> <name>Default + 404</name> <from>^/[^\s]+$</from> <to type="forward">^/search.jsf?q=$1</to> </rule>
This causes a stack overflow because it matches search.jsf - [^\s]+ , although there is a physical file matching search.jsf .
Every other rule has last="true" , since none of them should overlap (except for this catchall, obviously).
I read the UrlRewriteFilter manual and could not find anything except last="true" , which theoretically should stop the process from checking for other matches if it is already found.
Many thanks!
EDIT: With no answers and my inability to solve this problem, I checked an alternate way. See this question here.
source share