What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

The URL format of Stackoverflow is of the form .../id/question-title

If I add some more text at the end of the url like .../id/question-title-pink-unicorn and hit enter, the page is refreshed and the url is stripped of the pink unicorn I have just added. So far so good.

Then I change the url to .../id/question-title/persistent-pink-unicorn and hit enter, the page is refreshed and my pink unicorn is now a part of the url.

Edit: This doesn't look like a question although I submitted this via the Ask Question link. So here is the question. Will you allow my pink unicorn to reside on the site urls or this is something that should be fixed?

share|improve this question
    
So your issue is that in the second case the redirect to the canonical version of the url doesn't work? –  CodesInChaos Nov 16 '12 at 10:23
    
@CodesInChaos: No, the redirect works –  Manishearth Nov 16 '12 at 10:41

1 Answer 1

up vote 6 down vote accepted

The last part is just a URL slug. It makes the URL readable, instead of being just a post ID. The system just discards it, while we humans are able to glean some information about the link without having to open a new page. A similar thing happens with user profile pages.

The slash is probably not getting removed since when the system is overwriting the URL, it expects the discrepancy to have come from a post rename. Slashes are stripped when generating the slug (example), so it wouldn't expect a slash to be there at all. The script is probably split()ing the URL by slashes, and fixing only element [3]. No biggie(besides, the stuff after the slash can be used to link to an answer--I think).

Don't worry, your unicorns are safe with us.

share|improve this answer
1  
We're actually just using MVC route binding here, you can check out our open source RouteAttribute (which we should update, it's gotten more love). If the title doesn't match what's in the DB, we redirect...pretty simple stuff on our side. –  Nick Craver Nov 16 '12 at 10:53
    
As for linking to an answer, yes: meta.stackexchange.com/questions/3122/formatting-sandbox/… This includes a #123597 hash to scroll the the linked answer, but also includes the answer's id at the end of the URL as /123597, to ensure the correct page is shown when there are many answers. (In this example, I explicitly added a sorting order in the URL as well; without that the results depend on the last sorting order one used.) –  Arjan Nov 17 '12 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .