tags:

views:

72

answers:

4

Hello,

What would be the best way for a URL to look like if it should contain an ID and a name?

/product/123/screwdriver-black
/product/screwdriver-black/123
/product/123-screwdriver-black
/product/screwdriver-black-123

Thanks

+3  A: 

IMO use what SO uses.

/product/123/screwdriver-black

That way you are still able to access the product 123 via

/product/123

For example, while SO puts the question name in the link, it is 100% optional. You can still access this question with

http://stackoverflow.com/questions/3480964
Mike
A: 

as a rule it is best to limit the number of directories, as google is supposed to add weight to pages that are higher level e.g. not nested in multiple folders so something like /product/123-screwdriver-black would be best

however, In reality i'd use /product/123/screwdriver-black because it is cleaner and having worked on very large ecommerce sites with very good seo rankings i've found it makes little difference to google, as one good inbound link can make a bigger impact than almost any url formatting will.

Alex
"google is supposed to add weight to pages that are higher level" Then would it not be better to have a format like /screwdriver-black-p123 (p for product)?
johan
A: 

I would recommend

/product/screwdriver-black-123/

or

/product/screwdriver-black/123/

gsharma
You should perhaps explain why you would recommend those two solutions, especially since it seems to me both of those would be worse (and I'd lay bets many others would agree).
qstarin
I don't know why you think both of them would be worse, would like to know your opinion. The reason why I recommended is that you want to add your keywords before your ids.
gsharma
A: 

The preffered structure is that of significance.

More general to the top, more specific to the bottom.

This is the natural (well, according to G, we could always get into a big philosophical debate on that) linking order.

So, it only makes sense to use

/product/screwdriver-black/123

Product is more general than screwdriver and 123 is a specific screwdriver.

Makes sense. :)

john