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.

Example URLS:

product list:


single product:


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?:


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:


2 Answers 2


This is how I like to think about it, and it's the way Google suggests it in their "SEO Guide" which gives it credibility with my boss ;). You should be able to remove the end "directory" and get relevant content.


If you wanted some kind of filters you can do something along the lines of:


Then, to avoid duplicate content you would just use a canonical URL for products:


I think these urls are the most friendly.


It might help to draw out your hierarchical structure of your data (which I'm guessing might relate strongly with the hierarchy of your navigation); then build up your URL's based on this hierarchy. For instance:

     /-- about us   
home --- contact   
     \-- products --- furniture
                  \-- tools     --- hammer
                                \-- saw

For filters like price range, I would suggest using parameters, because these filters are not strictly hierarchical and (like you said) would compete with a hierarchical filter like "furniture".

So in short: If there is a strong hierarchy use www.site.com/products/tools/hammer; and if there is not a strong hierarchy, use parameters www.site.com/products/tools?pricehigh=100.

  • There's not a strong hierarchy so a product could be in multiple categories. I'd really like to avoid query parameters if possible.
    – User
    Commented Oct 2, 2012 at 17:48
  • I guess parameters have the advantage of easy combination of multiple filters, although I don't have a strong need for this at the moment.
    – User
    Commented Oct 2, 2012 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.