views:

177

answers:

4

I made a website that has a hierarchical structure and has search engine friendly (SEF) URLs like:

/seeds-1/
/seeds-1/fruits-2/
/seeds-1/fruits-2/black-berries-5/
/seeds-1/fruits-2/blue-berries-6/
/seeds-1/fruits-2/strawberries-7/
/seeds-1/vegetables-3/
/seeds-1/vegetables-3/potato-8/
/seeds-1/vegetables-3/onion-9/
/seeds-1/vegetables-3/cabbage-10/
/seeds-1/flowers-4/
/seeds-1/flowers-4/red-rose-11/
/seeds-1/flowers-4/tulips-12/

and so on. You'll notice that the numbers at the end are IDs. Now that I am done with the website and everything, a "consultant" intervenes and tells my client that "... urls are not 100% search engine friendly, to make them 100% search engine friendly, the numbers must be removed...". I obviously cannot talk to the "consultant" as they have done their job and disappeared.

I'll now appreciate if someone can point out the PROs and CONs for both types of URLs. I need some solid arguments to convince the client plus I really need to know if I've made a mistake choosing this kind of URL scheme for my website.

Edit ----

May be I am being lazy. The rewrite rules look like:

RewriteRule ^[^/]+-([0-9]+)/$ object.php?ObjectID=$1
RewriteRule ^[^/]+-([0-9]+)/[^/]+-([0-9]+)/$ object.php?ObjectID=$2
.
.
.

Its fairly easy to extract the ObjectID from query-string, cast it as an integer and use it in SQL query. I think using text comparison in queries (WHERE Name = '%s') is slower compared to using integer comparison (WHERE ObjectID = %d), therefore I am hesitating. The question is more like is it worth making the URLs more human-friendly at the cost of making them less coding/performance friendly.

+3  A: 

Searches for "seeds", "flowers", "vegetables" etc will match on the URL, so the URLs are good and engines will handle them nicely.

Whether you want to make them more human friendly is another issue.

cherouvim
+3  A: 

Agree with cherouvim and will expand.

Two things to consider here -

Human friendly is one point...if your user wants to type in vegetables/onions/vidalia instead of vegatables/onions-10, then it obviously makes more sense to the end user.

Also, the search engine could also pick up on a little more detail as well...so a search for vidalia onion may yield a better ranking for your website.

In the end, the consultant is promoting the buzzword of readability. Yes its probably overall better in the long run (and should be as simple as writing a nice little .htaccess file to fix), but there's really nothing wrong with your setup.

Edit

Honestly, it really boils down to what your customer wants. As other users have also specified, there really isn't much of a performance difference in how you present the links...

What really matters now is if your client wants it presented. Do they care if this sort of information is readable by humans? If they're just going to take the consultant's advice then you might as well just implement your rewrite rules.

espais
+1  A: 

From the technical point of view, you would only need the numerical IDs if the keywords are not unique in their contexts.

That is the case if, for example, there can be more than one seeds in the first level. Then you would need the numerical ID (or another unique value) to distinguish between the different seeds:

/seeds-1/…
/seeds-2/…
 ⋮

But if all keywords are unique in their contexts (the paths are unique), then you can remove the numerical ID without any loss of information.

Gumbo
+1  A: 

There's nothing wrong having ID's in the URL. It's done all over the place. For example:

  1. Here on Stack Overflow (/questions/2264708/search-...) or
  2. Amazon (http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/)

Are just two examples and there are more. Embedding ID's into the URL is almost ubiquitous, especially for large sites or large datasets where doing string comparisons on slugs are costly.

It will not hurt SEO at all. It might be a little less user friendly because users can't "guess" URL's, but that is a different problem altogether.

Christopher Nadeau
Any good example of where exact similar URLs (like those described above) are used. I think phpbb does but I cannot verify or find an online example.
Salman A