If you want, as in your example, to route all urls (including the root) to one method, your only need to define one route:
routes: {
"(:country)(/:city)": "index"
}
Because both parameters are optional, this will match:
- "" (Empty string)
- "england"
- "england/london"
If you want only the routes in format of england
and england/london
but not the root page /
, declare a separate empty route, and make the :country
part non-optional:
routes: {
"" : "home",
":country(/:city)": "index"
}