13

Why is it a bad idea to have a ID in the URL in terms of SEO? How does this URL http://example.com/user/1234 hurt SEO?

Can someone give me a practical example where search engine rankings are worse?

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
Tower
  • 98,741
  • 129
  • 357
  • 507
  • 1
    Would you mind citing where you heard that it was bad? My understanding is that it's bad if the user has a name, since names are possible search terms, so user/joe is better than user/47. – Dan Rosenstark May 26 '09 at 13:32
  • This is almost a duplicate of http://stackoverflow.com/questions/505793/do-seo-friendly-urls-really-affect-a-pages-ranking – Ian G May 26 '09 at 13:50
  • 1
    The problem isn't having an ID in your URL, it's having an ID INSTEAD of a relevant, keyword-laden string, or "slug". – Frank Farmer May 29 '09 at 18:58
  • 2
    I'm voting to close this question as off-topic because is about SEO, websites, and URLs which is a topic that should covered at https://webmasters.stackexchange.com/ – Stephen Ostermiller Feb 23 '18 at 19:03
  • @StephenOstermiller The fact that a question would be on-topic on another Stack Exchange site has no bearing on whether it's on-topic here - see https://meta.stackoverflow.com/q/287400/1709587 where this has been thoroughly established. Perhaps you're right that this is on-topic, but it's misleading to imply (as I think your comment does) that the fact that the question would be on-topic on another site is the *reason* for it being off-topic here. – Mark Amery Nov 19 '18 at 17:14
  • I'm not trying to say that it is off-topic because it would be appropriate for Webmasters. The [Tag:SEO] tag says: "GENERAL SEO QUESTIONS ARE OFF-TOPIC. Only programming-related SEO questions are acceptable on StackOverflow." This is not a programming question and it should not be on StackOverflow. Webmasters has a very similar question that is on-topic there: [Will having product ID in URLs hurt SEO compared to a URL with only keywords?](https://webmasters.stackexchange.com/questions/113717/will-having-product-id-in-urls-hurt-seo-compared-to-a-url-with-only-keywords) – Stephen Ostermiller Nov 19 '18 at 18:06
  • I'm voting to close this question as off-topic because [it is about SEO, not programming](//meta.stackoverflow.com/a/382618). General SEO questions may be asked on [Webmasters.SE](//webmasters.stackexchange.com/). – double-beep Jun 01 '19 at 13:11

8 Answers8

24

The reason people are saying that {ID} in the URL is bad is due to the way search engine algorithms work. When a search term is located in the actual URL, it is weighted much more heavily than the content of the page, etc.


For example:

<!-- http://example.com/blog/57 -->
<html><head><title>An article on search engine optimization</title>...

vs

<!-- http://example.com/blog/an-article-on-search-engine-optimization -->
<html><head><title>An article on search engine optimization</title>...

If you do a search in Google for "Search Engine Optimization" the second page, the one with the slug in the url will weight as a better result than the one with only the id.


You can deal with this in the same way that stack overflow deals with this issue:

http://stackoverflow.com/questions/{id}/{slug}
http://stackoverflow.com/questions/910683/why-is-id-in-the-url-a-bad-idea

The combined id and slug format really helps you achieve the best of both worlds. You get the ease of programming by retrieving records by {id}, but you also retain the optimized search URL because of the {slug}.

Astra
  • 10,735
  • 3
  • 37
  • 41
  • 2
    + 1 to this, because you can do this with little or no effort on your part. Notice that http://stackoverflow.com/questions/910683/oh-la-la-la-de-dah also brings us here... you're not doing any kind of search with the slug, just ignoring it. – Sudhir Jonathan May 31 '09 at 16:20
  • 3
    "When a search term is located in the actual URL, it is weighted much more heavily than the content of the page" may have been true in 2009 but it is not true anymore. Now Google puts barely any additional weight on keywords in the URL, either in the path, or in the domain name. I chalk up any effects of keywords in URLs to how users react to it, such as clicking on it more from the search results. See [Are keywords in URLs good SEO or needlessly redundant?](https://webmasters.stackexchange.com/questions/47342/are-keywords-in-urls-good-seo-or-needlessly-redundant) on webmasters. – Stephen Ostermiller Feb 23 '18 at 19:01
11

It does have an effect of the click-through rate.

The url is presented in green below the search result - so if it contains relevant words the user might click your site and not another site.

Which would you rather click:

www.test.com/page.php?u=85583

OR

www.test.com/Solution-to-your-problem.php

As commented this effect may be achieved even with urls including an id.

In the olden days it search engines treated words in url with much respect and gave those pages extra credit and higher ranking. This effect has almost vanished. We are left with two other effects of readable urls:

  • Clickthrough
  • Linkbuilding: Easier for a human to copy such a url and after the link is copied it is often referred to with some of the slug words. The url with "Solution-to-your-problem" may have Solution to your problem inside the a tag also when people link to your page. This will influence your ranking.

A solution with id + slug might be the best solution and it fixes the problem of keeping track of slug changes. test.com/85583/solution-to-your-problem

But there are some rules to follow, you should do a 301 redirect if the slug is incorrect to prevent a lot of duplicate content pages. Spam/duplicate content detecting kicks in if you got a lot of similiar pages:

test.com/85583/solution-to-your-problem test.com/85583/solution-to-yar-problem test.com/85583/evil-competitor-spamming-you-haha

Including the id also requires your ids to be as short as possible, an url with a full guid might be confusing to the eye and prevent a good clickthrough:

test.com/0CD03822-4A35-11DE-BF38-3F9356D89593/solution-to-yar-problem

Remember that Google News even demanded that you had an id in your url to be included.

Erwin
  • 662
  • 5
  • 12
  • 1
    Why not just do test.com/85583/solution-to-your-problem ? I still see no evidence that ID on the URL makes SEO worse. Some people sometimes claim that so I am interested in knowing whether there are cases when it happens. – Tower May 26 '09 at 16:32
4

See this Do SEO-friendly URLs really affect a page’s ranking? question. Based on the answers, no-one can find any proof that IDs in the URLs has any effect on SEO.

Community
  • 1
  • 1
Darrel Miller
  • 139,164
  • 32
  • 194
  • 243
4

Well, my name is Sudhir Jonathan, so if I want people to find me on your site, example.com/user/sudhir-jonathan is much much better than example.com/user/1234. Simply because the object of your page - "Sudhir Jonathan" - is now present in the url itself. This is a big win.

Similarly, example.com/articles/how-to-bake-a-cake is ranked much higher than example.com/articles/2379797 for the search term "bake a cake".

Sudhir Jonathan
  • 16,998
  • 13
  • 66
  • 90
1

It simple, search engines care words rather than number. That is to say, it will be better to see keywords in url than just ID sine ID/number is useless for search engines to determine whether your site is relevant or not!

tag
  • 215
  • 1
  • 2
  • 12
0

The url with id below is not bad for SEO:

                     # id ↓
http://example.com/user/1234

But, the url with slug is better for SEO because it is more informative:

                      # slug ↓
http://example.com/user/john-smith

I recommend to use both slug and id in a url as shown below because id is really useful to look up an object:

               # "slug" ↓
http://example.com/john-smith/1234
                         # "id" ↑

*You can see What is a slug and how to optimize it?, How to Create SEO-Friendly URLs and the answer to know more about slug.

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
0

It's always a bad idea to provide unusual information. Try the user name instead!

For SEO there is no real advantage/disadvantage between static ID urls and username urls.

Martin K.
  • 4,669
  • 7
  • 35
  • 49
0

1) you miss out on keywords in the url 2) it's harder for a human to read and understand what the link will be about 3) sql injection is a lot easier with IDs

henrikpp
  • 348
  • 2
  • 7