Skip to content

Routes Are Ordered

dscape edited this page Mar 3, 2011 · 2 revisions

Routes Are Ordered

rewrite algorithm is:

  1. Check the routes that match a specific request
  2. Get the first that matched and redirect according to the rule
  3. If none matched redirect to a directory with static files. This way you can still serve your css and javascript files by placing them in the /static/ directory.

Routes are matched in the order they are specified, so if you have these routes:

 <routes>
   <get path=":user">
   <get path="about">
 </routes>

the get route for the /:user will be matched before the get /about. To fix this, move the /about line above the :user so that it is matched first:

 <routes>
   <get path="about">
   <get path=":user">
 </routes>
Something went wrong with that request. Please try again.