Mobile app version of vmapp.org
Login or Join
Si4351233

: Why do Stack Overflow question URLs have the question ID before SEO friendly 'question'? Take for example this random question: Tool or plugin required to show out in which html files a given

@Si4351233

Posted in: #Url

Take for example this random question: Tool or plugin required to show out in which html files a given css selectors is used, notice that the relevant part is /questions/16999.

Now, it being possible that the url could have been done like this :
webmasters.stackexchange.com/questions/tool-or-plugin-required-to-show-out-in-which-html-files-a-given-css-selectors-is/16999`

That is the question_id is after the question, and what comes first in a url weighs more in seo, why is the question part coming after the question_id.

I also read in an article that only the first two subdirectories are relevant therefore only /question/16999 is relevant. Looking at SO this is definitely not true, but I can't decide on the weigh of this.

I am asking because I am going to implement seo optimizations and don't want to have to change the link to my pages afterwards.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Si4351233

3 Comments

Sorted by latest first Latest Oldest Best

 

@Shelton105

I do not know exact reasons why StackExchange sites do have ID before slug, but here is why I would have it this way:

Sometimes URL can be truncated (intentionally (too long to store in DB etc) or by mistake (happens quite often when copy-paste)) .. 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 this site has special treatment for such scenario). With ID at the end you possibly would see completely different question (the most common behaviour in such case).. or just error page (when server/script ensures that slug matches ID).

With regards to SEO effect -- see this question: SEO : urls : best place for the id

10% popularity Vote Up Vote Down


 

@Annie201

The processing of the URL by the server is ignoring the portion of the URL following the question id number and slash. All of these are equivalent:


/questions/16999
/questions/16999/
/questions/16999/any-text-at-all


They all redirect to the URL having the (reformatted) question text after the slash.

This allows them to use the short form URL in links from one page to another (such as the links in the Related sidebar on this page), saving HTML transmission time as well as storage and cpu cycles. By having the question-text in the canonical URL (the one redirected to), they still get the benefits of having relevant text in the URL for use in search engine indexing.

10% popularity Vote Up Vote Down


 

@Welton855

Yes, it's they could have added the ID after the question title if they had wished.

Regarding the position of the ID and SEO, in my opinion I don't think it would make any difference (ok maybe if it was in the domain name).

From a human readability point of view, it seems clearer (to me at least) to have the human readable title at the end, rather than burried in the URL.


I also read in an article that only the first two subdirectories are
relevant therefore only /question/16999 is relevant. Looking at SO
this is definitely not true, but I can't decide on the weigh of this


Where did you read this? I don't think it is correct, and nowadays these re-written URLs don't usually relate to subdirectories in any way.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme