For example, suppose I have a site with products and product categories. I'm trying to come up with a good intuitive url structure. I want to use name slugs throughout rather than database ids. In general I'm not a fan of query string parameters (e.g.,
www.example.com/products?category=tools) so where possible I'd like to avoid them.
this is fine and I have this working. Where it gets more complicated is where I want to add categories.
all products in a category?:
www.example.com/categories/furniture www.example.com/products/furniture www.example.com/products/by-category/furniture
What about new products?:
Or products under $10?:
What makes sense? Is there some kind of convention? Is there an article about this? I would imagine the rails community would have covered this (although not using rails myself) but I can't find a resource. One thing about using products/some-filter is that its competing for the same namespace as individual product listings and there is a potential for a clash.
I should add that there is not a strong hierarchy so it doesn't make sense for a single product to belong to a category as it can belong to many categories. So a url such as www.example.com/tools/hammer (where hammer is a single product) wouldn't work.
When I look at this site (and other stack exchange sites) for tags they use:
and questions with a given tag:
and a single question:
Treating tags as analogous to categories this would give an analogous structure of:
www.example.com/categories www.example.com/products/by-category/tools www.example.com/products/hammer