Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I would like to know what's the best location for an id in a SEO optimized URL:

http://www.site.com/id/slug-title

http://www.site.com/slug-title-id

What do you think ?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

Look no further then the URL of this page:

http://webmasters.stackexchange.com/questions/16641/seo-urls-best-place-for-the-id

It's in the http://www.site.com/action/id/slug-title format. But truthfully, both work well and are optimized for the search engines.

share|improve this answer
1  
Thanks for your answer I was just wondering if this way un-needed weight is given to the id –  mnml Jul 10 '11 at 16:43
4  
@mnml I recommend option #1 as well -- sometimes URL can be truncated (intentionally (too long to store in DB etc) or by mistake) .. and if id is before slug, the server/script can still recognize the page you want but with id at the end it most likely will not. Try URL of this page -- remove last few characters and submit -- server will redirect you to the correct URL (apparently the code behind has special treatment for such scenario). With id at the end you possibly would see completely different question (or error page). –  LazyOne Jul 10 '11 at 16:52
4  
This answer contains no references or documentation. (other than the assumption that SO must be doing it correctly?) –  Kirk Woll Aug 27 '12 at 18:19
add comment

Put the id near the beginning. I had some URLs with ids near the end and it caused a problem. Sometimes URLs get truncated. This is especially true when they are shown in the page and not linked.

Your website can probably figure out what to show if the link is

example.com/12345-this-is-the-whole-title-o...

but might not be able to in the case that the id is in the part that was truncated.

example.com/this-is-the-whole-title-of-the-...
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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