# SEO: adding an unecessary description key in dynamic url is it good or not?

in the typical DB driven cms/ecommerce site you will have items pages at urls in some form similar to:

http://www.domain.com/item.php?id=36


1) Is it good for SEO purpose to add a sort of description (related to page contents) in url? i.e.

http://www.domain.com/item.php?id=36&descr=cheap-blue-jeans


even if descr key is not needed by the webapp to retrieve item from DB, thus making the url to work with/without the descr key and to show the same identical page.

I'm asking because for instance my profile on Pro Webmasters seem exactly to do this:

http://webmasters.stackexchange.com/users/1429

http://webmasters.stackexchange.com/users/1429/marco-demaio

They are the same url, the marco-demaio value is not needed, only the 1429 value is needed to get my profile from DB.

NOTE: in this last example I think also url rewrite is involved, but this question goes beyond urls rewrite, I'm not interested in rewriting any url here and to whoever is an url-rewrite-addict I would suggest to read this Google official article.

2) Supposing the answer to (1) is yes or almost yes, do I need to do a redirect 301 (or use canonical)? And if yes from http://...?id=36&descr=cheap-blue-jeans to http://...?id=36 or viceversa?

3) Supposing answer to (2) is "yes you better do redirect", why do I need a redirect (or canonical)? I mean do I even need redirect/canonical when I'm absolutely sure that my webapp will never link to both pages, so you will never find in the site the same page linked in two different ways (i.e. all link to id=36 will be in the form http://...?id=36&descr=cheap-blue-jeans so why does Google should care about http://...?id=36, I mean it should never get even indexed and therefor I should not ever have duplicated contents issues.

If you arrived here, thanks for the patience in reading into all this, and more thanks for any replies. :)

-
"I'm not interested in rewriting any url here and to whoever is an url-rewrite-addict I would suggest to read this Google official article." There's nothing wrong with URL rewriting if done correctly. I would go so far as to say that if you wish to have readable URLs, query strings should be eliminated entirely unless that item requires pagination or result sorting. –  Lotus Notes Nov 16 '10 at 19:13
Related reading: webmasters.stackexchange.com/questions/5376/… to deal with SEO problems relating to URL rewriting. –  Lotus Notes Nov 16 '10 at 19:16

The unfortunate thing about the Google article you posted is that it's almost creating more myths than it quashes. It's true that search engines do not have any problems indexing dynamic URLs, but static-looking URLs still tend to rank better.

The main reason is that when you create static URLs they are less "watered down" with irrelevant characters and keywords. If you take this, for example:

products.php?id=123&descr=product-name&view=comments


Here you have php, id, descr and view as essentially irrelevant keywords to the page. It won't actively harm your ranking, but in some ways it's akin to calling your brown dog photo my-black-cat.jpg.

As others have said, clear and concise URLs are best for users and search engines alike. products/123/product-name/comments is much easier to grasp than the above. If it's possible to have unique "slugs" in the URL, remove the ID and go with a format like products/product-name/comments.

1. Yes, that will improve SEO over just having the product ID. But it's still better for users to have a static-looking URL.
2. Either or both is fine. I believe Canonical and 301 act the same in terms of passing PageRank etc. Normally canonical is used due to technical restrictions, or as a plaster.
3. It depends on how and when you redirect. For example, if you only redirect when the descr parameter does not match the description for the product specified by id, you're missing the situation when someone goes to ?descr=cheap-blue-jeans&id=36. So it's always good to include it, in case you've missed a redirect.
-
Thanks, very well explained. –  Marco Demaio Nov 16 '10 at 19:43

If the dynamic URL is crawled somehow by the Search Engine then a description wouldn't hurt. After all, its about helping the search engine to index pages better, ain't it?

Besides who is more recognizable 1429 or marco demaio?

-
Agree, but unless I do an hash table, I still need 1429 in the url (to get item form DB key) and so does the user that needs to remember the 1429 too, so I'm not so sure that this is considered good by SE. –  Marco Demaio Nov 15 '10 at 17:41
If the SE looks up for marco it is going to find it at the URL, thus it indexes it better. Better keep the description –  Starx Nov 16 '10 at 5:56
@Marco: if you can guarantee unique strings then it's not a problem to look up by marco-demaio instead of 1429. If you index that text field then there is little difference. –  DisgruntledGoat Nov 16 '10 at 19:10
@DisgruntledGoat: unique string degrades performances because you need either to do a DB lookup based on string key that is supposed to be much slower than doing a DB lookup based on numeric key (that's the reason why DB table keys are usually numeric) or you need in the webapp "some kind of hash table that is constantly updated whenever you C/R/U/D" as commentd by Lotis Notes on Dave's answer. Moreover I wonder why –  Marco Demaio Nov 16 '10 at 19:43
@Marco Demaio Having a unique string field doesn't mean you can't also have the regular numeric primary key. –  Lotus Notes Nov 16 '10 at 22:01

As always, putting users/usability first produces the best SEO results.

1. Creating descriptive URLs helps both users and search engines know what the page is about. So, yes, it's always better to use http://domain.tld/product/36/cheap-blue-jeans than http://domain.tld/product/36.

2. If the descriptive URL is more useful to users & search engines then naturally that's what you want to be indexed and to be used as the canonical URL.

3. Better safe than sorry. Why would you risk creating duplicate content? There are no benefits to it, only harm. Would you create an unsecured backdoor to your website so long as it's not linked to from anywhere?

-
Much better answer than mine....... –  Starx Nov 15 '10 at 12:29

This is why I'd hate industry made solutions.

I do everything by hand (I have my own framework and so on, so, speed to deliver is not an issue for me), in order to make site more userfriendly.

See the evolution:

The last one, IMHO, is the most concise, friendly and relevant option. What need' to achieve that?

• mod_rewrite, as other solutions.
• create a database index on the short description field, so we can keep things fast
• a simple routine to find products by description, instead by id.

A few extra work, a significant bit of friendlyness to users. Yes, because, numbers in urls does say nothing to users, nor search engines. Keep support to them as fallback may be an option, but using only descriptions makes more sense to me.

-
I too use my own framework and I would like to get rid of the numeric ID so I'm wondering how you implement this. Are you performing a database query on any request that goes into the /product/ "folder", or do you have some kind of hash table that is constantly updated whenever you C/R/U/D products? –  Lotus Notes Nov 16 '10 at 19:14
@Lotus: For the URLs above, you'd simply store a unique slug/alias in the table for each product, and use that as a lookup, i.e. SELECT * FROM products WHERE alias='cheap-blue-jeans' –  DisgruntledGoat Nov 16 '10 at 19:39
@Lotus, DisgruntledGoat got it. Also I added a short recipe how to do it. Keep the alias column into table, and make an index into it for performance reasons. For internal operations, table joins and so on, using primary key is vital for performance, but for simply selecting one row data, an index is good enough. –  Dave Nov 16 '10 at 20:24
@DisgruntledGoat: makes sense, thanks for sharing. +1 –  Marco Demaio Nov 17 '10 at 12:14