title: URL Rewrite JSP
body: <p>I know this topic has been covered in lot of question but i could not find the right answer to my the issue i am facing. So it goes like this</p>
  
  <p>I have a URL like this </p>
  
  <pre><code>localhost:8080/web/Area.jsp?name=food
  </code></pre>
  
  <p>I want to achieve the following for better SEO</p>
  
  <pre><code>localhost:8080/web/food-loc-hyd
  
  Note: 
  food is a input which has 1000's of variants like apple,dish,etc.
  
  -loc-hyd is a static keyword and is added to every food
  </code></pre>
  
  <p>I tried URL rewrite filter from tuckey but I am not getting the correct combination. My name parameter above has thousands of different variables which can be given as input, so I tried something like this.</p>
  
  <pre><code>&lt;rule&gt;&lt;from&gt;^/*-loc-hyd&lt;/from&gt;
  
  &lt;to&gt;/Area.jsp?name=*&lt;/to&gt;&lt;/rule&gt;
  </code></pre>
  
  <p>I have a similar request which needs to be cleaned up which looks like this</p>
  
  <p>from:</p>
  
  <pre><code>localhost:8080/web/Area.jsp?name=food&amp;address=ind
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>localhost:8080/web/food-loc-hyd/ind
  </code></pre>
  
  <p>Please guide on how to go about it.</p>
  
  <p>Thanks , I am off to a start. I have done the above and its working to an extent. My navigation is like breadcrumbs structure so it goes like this </p>
  
  <p>localhost/web/loc where loc is a variable so I have the following and it works: </p>
  
  <pre><code>Rule 1:
       &lt;from&gt;^/([^-]+?)&lt;/from&gt;
       &lt;to&gt;/Area.jsp?name=$1&lt;/to&gt;
  </code></pre>
  
  <p>Now when a user is on /hyd, I am sending him to /hyd/app and then to /hyd/app/lic where in both app and lic are variables so I did something like this:</p>
  
  <pre><code>Rule 2:
      &lt;from&gt;^/([^-]+?)/([^-]+?)&lt;/from&gt;
           &lt;to&gt;/app.jsp?name=$1&amp;app=$2&lt;/to&gt;
  </code></pre>
  
  <p>Rule 1 and Rule 2 are working, but rule 3 below is not working, it is being handled by the  rule 1.</p>
  
  <pre><code>Rule 3:
      &lt;from&gt;^/([^-]+?)/([^-]+?)/([^-]+?)&lt;/from&gt;
           &lt;to&gt;/lic.jsp?name=$1&amp;app=$2&amp;lic=$3&lt;/to&gt;
  </code></pre>
  
  <p>Any ideas where I am not doing it correctly.</p>