This was originally a comment, because I had assumed it was considered and not used prior to this question being posted..
At the moment, these are your URLs (with "summary" being a type of action, presumably):
/region
/region/{action}/{id}
Your question is, what should you do if someone tries to access it without an ID, like this:
/region/{action}
I say: Don't allow it in the first place, and shape your URLs conceptually like this:
/region
/region/{action}
/{region}
/{region}/{action}
So with this mapping: {region} -> region/{id}
, you get the URLs:
/region
/region/{action}
/region/{id}
/region/{id}/{action}
/region
would still go to the same place you intend; a landing page.
/region/{id}/summary
does the same thing as your /region/summary/{id}
/region/{id}
basically would mean "Get me information about Region {ID}", which could either 302 to /region/{id}/summary
, or just return that page.
- Likewise for
/region/summary
- the user is asking for information about the landing page. It should return the same thing as /region
(or 302 to it, or /region
should 302 to here).
RESTful URLs like this are used in web APIs, and they're pretty intuitive, making it a good model for sites that can use them.
Two more sets of examples from the StackExchange API (which, granted, doesn't include /tags/{tags}
):
/badges Get all badges on the site, in alphabetical order.
/badges/{ids} Get the badges identified by ids.
/badges/recipients Get badges recently awarded on the site.
/badges/{ids}/recipients Get the recent recipients of the given badges.
/tags Get the tags on the site.
/tags/{tags}/info Get tags on the site by their names.
/tags/synonyms Get all the tag synonyms on the site.
/tags/{tags}/synonyms Get the synonyms for a specific set of tags.
And one from this Edit Answer page (which, unfortunately, doesn't work without /edit
...):
http://ux.stackexchange.com/posts/39273/edit
region/{id}
? I mean, it sort of means "get me region information about {id}", which in your cause means the summary - unless there's another "base" page for each region, in which case, I'd suggestregion/{id}/summary
, so each level of the URL is still valid./region
and/region/{id}
./region/{id}
is the summary, and then have/region/{id}/{action}
. Makes more sense semantically.