For example, I have a webshop where each product has its unique ID and I want to build SEO friendly URL for a product page. An old-school way that is mentioned almost in every article looks like this: http://mywebshop.com/categoryname/1111-some_product_name where

  • 1111 is ID of the product and is important
  • some_product_name is just for google and users; changing this text to "some_other_product_name" will not have any effect

But some websites (including StackOverflow) uses different format and build URLs like: http://mywebshop.com/categoryname/1111/some_product_name

So, my question is which URL is better from search engine point of view? http://mywebshop.com/categoryname/1111-some_product_name OR http://mywebshop.com/categoryname/1111/some_product_name? Is there any reason why forward slash should be used instead of hyphen?

From implementation point of view there is not so much difference. Also, for the end-users they look identical.

UPDATE 2017-03-02 @John Conde: this is not the duplicate. The link that you provided explains how to structure URL if you have hierarchy of entities. I agree that my question looks similar, but in my case I have parts of the URL that will never be part of user's search phrase (i.e., nobody will try to search for "1111", users type in product name).

  • 1
    There is a difference between a slash (/) and a hyphen (-) in semantics. The slash signifies semantic clusters, terms to be considered together and separate from other clusters, while the hyphen only signifies the separation of terms. So for /categoryname/1111-some_product_name, /categoryname/ and 1111-some_product_name are two separate clusters to be semantically weighted separately, and the hyphen (-) and underscores (_) 1111-some_product_name act as term separators only. Semantics can see terms accurately if concatenated so that categoryname will be category name. Cheers!! – closetnoc Feb 27 '17 at 16:43
  • Thank you! Looking at your answer and the answer from Rob, I see that the best strategy is to structure URLs like Rob suggested. So, more relevant keywords like category name and product name are following each other, and non-relevant search terms (i.e., ID) are at the very end. – Volodymyr Usarskyy Mar 2 '17 at 21:53

Google, at least, will consider a name with a hyphen in it as part of the whole. In other words, the name of a product with a URI of "1111-product" will become "1111 product". So, it would make more sense to use a URI with the actual product name followed by any variation of the name or product: "/product/1111".

That can then be thought of product ID 1111. If you come out with a new variation or model of that product, it can have an URI of /product/2222.

This is actually how we do things in a REST methodology.

I would not use underscores. Use hyphens for the reason I gave above. Google considers hyphens to be spaces in listings while underscores are not (if I recall correctly).

In addition, underscores are often missed in the address bar cause they're harder to see.

There are other reasons for not using underscores that I just don't recall right now but I abandoned any thoughts of using them 10 years ago.

  • OK, so basically, if I have no other option than to keep "1111" as part of the product name, it is better to place it at the end, right? The URL will look like mywebshop.com/categoryname/some_product_name-1111 which technically should improve SEO results. P.S.: in my case I can change code as I need, so I will restructure URL as you advised. – Volodymyr Usarskyy Mar 2 '17 at 21:49
  • No, I'm saying it should be like this: mywebshop.com/categoryname/some-product-name/1111 where the slashes indicate a modified version of the product. If you use a hyphen, as you show, then the 1111 will be included as part of the product name. – Rob Mar 2 '17 at 23:07

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