How can I set up a filter URL like example.com/category/foo/type/bar/country/usa Given a category based set of entries/products, and a filter system based on tags, how would I accept (one of) the following urls and let one template process them all (not interested in the processing, just want to know how to set up the route):


example.com/category/foo -> category page, containing products
example.com/category/foo/type/bar -> category page, filtered by relation to tag (group = 'type') with value 'bar'
example.com/category/foo/type/bar/country/usa -> category page, filtered by multiple relations (filters)
example.com/category/foo/country/usa/type/bar -> category page, filtered by same relations as above


This would be more SEO-friendly than example.com/category/foo?type=bar&amp;country=usa

Anyone done this before?
The parameterized paths (as opposed to the queries) implies a certain hierarchy. According to Google's SEO document, you have to anticipate that users will cut a part of the URL off. What happens if they cut out "usa", but "country"?

What you're doing right now is filtering/searching, not creating a hierarchy. So, you're complicating your own routing (making it more likely to fail and thus hurting your SEO even further), and not conveying the information particularly accurately.

If you want the parameterized URLs as opposed to query strings, you'll want to reorganize your URL structure to be hierarchical -- i.e. - products/shirts/tshirts -- and drop off the "parameter names" that you're trying to shoe-horn in. 

Also, consider whether that particular page actually needs to be indexed by search engines, and if it needs to be indexed with the query string. Can you simply allow it to be indexed without any filtering? Does it need to be indexed at all? If you don't need to index it, then you can keep the query string for human usability, and tell spiders not to index it at all. If you don't need to index it as filtered and going to the page, without a query string, results in the non-filtered content, then most spiders will do that by default.

For example, look at google.com, before and after a search. Obviously, search result pages don't need to be indexed (nor would you want to, because that would result in a ton of botched indexed), but the main page, itself, probably should be. As a result, they use a query string that includes q=searchstring on their search results page.