This RFC has been scheduled for public discussion on June 28 (Wednesday) at 21:00 UTC (2pm PDT, 23:00 CEST). As always, the discussion will take place in the IRC channel #wikimedia-office
### Problem statement
Currently `/wiki/Redirect` responds with the Target page, with three notable differences:
* A "Redirected from .." message is rendered.
* A piece of JavaScript is inserted that will jump to the destination `#Section` (if any).
* A piece of JavaScript is inserted to normalise the address bar from `/wiki/Redirect` to `/wiki/Target#Section`.
Internals:
* Page markup (wikitext) refers to the title as specified. – `[[Redirect]]` is saved as-is, no pre-save transformation)
* Page rendering refers to the title as specified – HTML: `<a href="/wiki/Redirect">`
* When clicking on such link within the wiki, or otherwise navigating "to" the redirect, the server responds with a modified version of the response for the target of the redirect. – `/wiki/Redirect` responds the same as `/wiki/Target`, including a `<link rel=canonical>` specifying `Target` as canonical, and a special header informing the reader "Redirected from Redirect".
* Once the page is rendered, JavaScript does two things:
* Jump to the intended section (if any).
* Swap the address bar from `/wiki/Redirect` to `/wiki/Target`. This encourages further social sharing to share the canonical link, and makes it so that those other people will not needlessly see "Redirected from Redirect" - which doesn't apply to those readers.
Benefits:
* Parser cache: Changing the redirect does not require invalidating parser cache of incoming links.
* Performance: "Following" a redirect responds quickly (no HTTP redirect).
* Usability: Users know when they followed a redirect (header message "Redirected from"), and the message doesn't show for others when you share the link.
* Search engines: No indexing of duplicate content. (due to canonical url).
Problems:
* **Redirect to heading**: When redirecting to a heading on a destination page (e.g. `Topic` redirecting to `General#Topic`), the browser does not natively jump to this heading because it's rendering content at `/wiki/Topic` not `Topic#Topic` or `General#Topic`. This is currently worked around with JavaScript. While this technically works it is bad in two ways:
* Performance: The jump happens very late. Sometimes 5-10 seconds after the first paint, because it waits for all content to arrive and all JavaScript to arrive and execute.
* Fallback: In our Grade C experience for older (but supported) browsers, the jump never happens.
* Fallback: It also means that on supported browsers, the jump doesn't happen if there were intermittent connection issues.
* Fallback: There is no recovery for the user when the jump doesn't happen. There is no manual way to get to this information (it's hidden in invisible JSON data)
### Solution 1
Change the response of `/wiki/Redirect` to be an HTTP redirect to `/wiki/Target?rdfrom=Redirect#Section`, with client-side code to normalise to `/wiki/Target#Section`.
This addresses all the problems.
* Drawback: Users will be subject to an HTTP redirect.
* Benefit (compared to Solution 2): Redirects are instantly up-to-date (no need to wait for job queue).
### Solution 2
Change the response of `/wiki/Redirect` to be an HTTP redirect to `/wiki/Target?rdfrom=Redirect#Section`, with client-side code to normalise to `/wiki/Target#Section`.
In addition, optimise the common case by changing the Parser to resolve to this url ahead of time.
* Benefit: Faster user experience for the common case.
* Drawback: Updating of urls depends on job queue, similar to template transclusion updates.
>>! Original task description:
>
> With Javascript disabled/not available:
>
> *Links to sections, works correctly, e.g. [[https://en.wikipedia.org/wiki/Albatross#Biology|Albatross#Biology]]
> *Links to sections via a redirect, works correctly, e.g. [[https://en.wikipedia.org/wiki/Beiruit#History|Beiruit#History]] -- ([[Beiruit]] is a redirect to [[Beirut]]).
> *Links to sections via a redirect to a section, do Not work correctly, e.g. [[https://en.wikipedia.org/wiki/Camden Market Fire|Camden Market Fire]] takes you to the top of the target page but not to the section -- ([[Camden Market Fire]] is a redirect to [[Camden Market#Incidents]])
>
> Fixing this may partially fix the section links issue in {T53122}
>
> See also:
> * {T144781}
> * {T37858}
> * {T20883}
> * {T37045}