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



2 Answers 2


Look no further then the URL of this page:


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.

  • 1
    Thanks for your answer I was just wondering if this way un-needed weight is given to the id
    – mnml
    Commented Jul 10, 2011 at 16:43
  • 6
    @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
    Commented Jul 10, 2011 at 16:52
  • 8
    This answer contains no references or documentation. (other than the assumption that SO must be doing it correctly?)
    – Kirk Woll
    Commented Aug 27, 2012 at 18:19

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


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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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