# Permalink to answer redirects to question if title has changed (or if title holds special characters)

/questions/71561/please-fix-this-first/71637#71637


...tries to redirect to a URL with the current title and then instead gets one the question (a URL without the answer id, nor its fragment identifier):

GET /questions/71561/please-fix-this-first/71637 HTTP/1.1
Host: meta.stackoverflow.com

HTTP/1.1 301 Moved Permanently


Problems:

• This surely fails when pagination kicks in, due to the missing /71637 answer id.

• Scrolling: after the redirect, some browsers add the #71637 fragment (Firefox, Chrome) or silently apply it (IE8). Safari does not add nor apply the fragment after a redirect. (I guess that's a Safari bug, and it's a shame IE8 does not show the fragment in the URL.)

• I'm not sure if there's any effect for SEO (pagination aside). The links are not no-follow:

<a href="/questions/71561/please-fix-this-first/71637#71637"


In rare occasions, the same problem occurs when not changing the title, but when using some specific characters. Like right now, What should community ♦ mods do with spammers? has a URL like:

/questions/74440/what-should-community-mods-do-with-spammers


Clicking that gets one redirected to a URL with two subsequent dashes (due the diamond symbol being replaced, or something like that):

/questions/74440/what-should-community--mods-do-with-spammers
^
Extra dash after redirect


Odd, but the resulting URL works. (The title on that page still uses the URL without the double dashes.) Again, the very same redirect occurs for the permalinks to specific answers. Like:

/questions/74440/what-should-community-mods-do-with-spammers/74444#74444


...gets redirected to:

/questions/74440/what-should-community--mods-do-with-spammers


Note that manually adding the extra dash works (and avoids the redirect):

/questions/74440/what-should-community--mods-do-with-spammers/74444#74444


Also note this does not happen for titles with quotes and parentheses, nor for colons — so maybe only for multi-byte characters?

• For me, navigating to the answer permalink brings me to the answer, even though it is rewriting the URL to the answerless version with two dashes. IE8 on XP, if that matters. – Grace Note Jan 9 '11 at 21:18
• @Grace, that is very odd. I added a link to web-sniffer which clearly shows the 301 Moved Permanently as well. I never thought this might be browser dependent...? You are using this link, right? – Arjan Jan 9 '11 at 21:22
• Yes, Arjan. I've tested it by clicking the link in your post, manually entering the URL, and also clicking on the "link" button on the answer itself. All of them resolve the same way: goes to the URL with 2 dashes, but auto-scrolls the screen to the answer. I tested with the other answers in that question, too, they go to the correct answer. – Grace Note Jan 9 '11 at 21:25
• And, @Grace, do you get /74444#74444, or just #74444, at the end? – Arjan Jan 9 '11 at 21:26
• Ah, nice catch. I wonder if this ends up causing real problems on questions with paged answers, since the trailing answer ID is actually important there... – Tim Stone Jan 9 '11 at 21:30
• Neither, Arjan. The URL I reach is http://meta.stackexchange.com/questions/74440/what-should-community--mods-do-with-spammers. By all means, I shouldn't have the auto-scroll. It's as if it queues up the scrolling before it rewrites the URL. Or something. – Grace Note Jan 9 '11 at 21:32

1. a bug in our UrlFriendly() routine where it didn't let a non-translated international character inherit the "is a dash" status of the previous character