views:

985

answers:

10

I'd like to start using "SEO Friendly Urls" but the notion of generating and looking up large, unique text "ids" seems to be a significant performance challenge relative to simply looking up by an integer. Now, I know this isn't as "human friendly", but if I switched from

http://mysite.com/products/details?id=1000

to

http://mysite.com/products/spacelysprokets/sproket/id

I could still use the ID alone to quickly lookup the details, but the URL itself contains keywords that will display in that detail. Is that friendly enough for Google? I hope so as it seems a much easier process than generating something at the end that is both unique and meaningful.

Thanks!

James

+13  A: 

http://stackoverflow.com/questions/820493/can-an-seo-friendly-url-contain-a-unique-id

I'd say you're fine.

Tom Ritter
Although note you get extra SEO points for having the title in the URL but you can omit to read it when extracting the product, article, etc. I think it's not as much as having an unique ID that's bad than having a description of the page you're opening that's good.
lpfavreau
+8  A: 

Have a look at the URLs that StackOverflow uses. They have a unique id, then they have the SEO-friendly stuff. You can omit the SEO-friendly stuff and the URL still works.

Paul Tomblin
+2  A: 

You are making a devils bargan here, you are trading away business goals for technology goals.

If you were to ask "From a purely business and SEO prospective, is it better to include unique IDs in the URL or not?"; the answer would clearly be to not use them.

The question then becomes, if you do use them, how much does it hurt you in the search engines? The answer is that it definately has some negative impact. How much is yet to be determined.

In terms of "user friendly", no, they are definitely not user friendly.

In terms of Google, they state "Whenever possible, shorten URLs by trimming unnecessary parameters." See their URL structure document.

JonnyBoats
And how do you comment that all URLs submitted to Google News *have to* contain a numeric ID?
Török Gábor
With respect to Google News, I guess my answer is that Google is Google so they can do anything they want. In other words you need Google more than Google needs you. Google treats "Google News" as a special case with different routines than standard websites.
JonnyBoats
If I can find more pertinent searches on Google as a result of meaningful SEO like shaping links, then that's a usability gain on the website -- technical enough in my book.
Rei Miyasaka
+1  A: 

Nothing wrong with that. An increasing number of services have started to use a hybrid solution as Paul Tomblin already pointed out. In addition to SO, Tumblr uses this pattern too (maybe it was the first).

Furthermore, in certain services—like Google News—the URL must contain a unique numeric ID.

Török Gábor
+1  A: 

Getting rid of the parameterized URL will definitely help. From my experience, including the ID does not hurt or help, as long as there are no '?key=value' pairs in the url.

ftank99
+1  A: 

I'm not aware of any problems caused by adding an ID to a URL. In fact it can be extremely useful, as it allows the human/search engine friendly part of the URL to be changed without causing a broken link to a page that a search engine has already indexed. Using SO as an example, here's a link to your question:

http://stackoverflow.com/questions/820493/you-can-put-any-text-you-want-here

Nick
A: 

Use something like modrewrite to parse URLs before they reach your server. So you could convert a slug like http://oorl.com/99942/My-Friendly-Text-For-Search-Engines/ into http://oorl.com/lookup.php?id=99942. This will also let you change slug and keywords used to optimize certain links without damaging functionality.

Patrick Gryciuk
+1  A: 

Be careful with allowing a page to render using the same method as Stack overflow.

htp://stackoverflow.com/questions/820493/random-text-can-cause-problems

Black hats can this to cause duplicate content penalty for long tail competitors (trust me).

Here are two things you can do to protect yourself from this.

  1. 301 any inbound display url that matches your ID but doesn't match the text to the correct text.

ex. htp://stackoverflow.com/questions/820493/random-text-can-cause-problems 301 -> htp://stackoverflow.com/questions/820493/can-an-seo-friendly-url-contain-a-unique-id

<link rel="canonical" href="http://stackoverflow.com/questions/820493/can-an-seo-friendly-url-contain-a-unique-id

" />

(sorry had to change my links to htp:// due to being a new user, even though they were example.

Julian Sutter
A: 

Yes, and in fact it's more SEO friendly to include a number in your url as it implies to google that you are consistently updating your content.

I am fairly sure that it makes it much more difficult to get indexed in Google News if you don't have an incrementing number attached in some way to your URLs.

cam8001
A: 

I have two seemingly contradictory points to make here:-

  1. Nobody looks at URLs! Experience has "trained" browser users to render the "Address" box contents as invisable, they know the contents will be any two of 'ureadable', 'meaningless' and 'confusing', hence they just ignore it completely.

  2. Using a String which can be easily converted to an integer may offer a slight performance advantage over using a longer string which is slightly harder (hash() vs. to_int() ) to convert into an integer. However in the context of the average web application any performance difference would would be negligable.

My advice would be to stick with what your comfortable with.

James Anderson