6

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:

www.example.com/products

single product:

www.example.com/products/hammer

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

www.example.com/products/new

Or products under $10?:

www.example.com/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.

UPDATE

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:

http://ux.stackexchange.com/tags

and questions with a given tag:

http://ux.stackexchange.com/questions/tagged/urls

and a single question:

http://ux.stackexchange.com/questions/26340/recommended-url-structure-for-products-and-categories-in-mvc-app

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
1

2 Answers 2

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.

http://clothing.com/mens/shirts/three-wolf-moon
http://clothing.com/mens/shirts
http://clothing.com/mens

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

http://clothing.com/mens/price:0-10/color:red

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

 http://clothing.com/three-wolf-moon

I think these urls are the most friendly.

1

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.

2
  • 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
    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
    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.