Page MenuHomePhabricator

WMF wikis don't redirect to short url, and instead shows bare /w/index.php
Closed, DeclinedPublicFeature

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:
you get taken to https://en.wikipedia.org/w/index.php?title=Wikipedia:Don%27t_delete_the_main_page&action=edit

What should have happened instead?:
you get taken to https://en.wikipedia.org/wiki/Wikipedia:Don%27t_delete_the_main_page?action=edit

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

image.png (564×628 px, 35 KB)
chrome/win10

Event Timeline

/w is the $wgScriptPath setting in CommonSettings.php for all Wikimedia sites (line 505), so this isn't unique to enwp and has been the case for as long as I can remember :-)

I think it could be changed by $wgActionPaths if I'm reading this part of Manual:Short URL correctly? I'm not sure of the benefit though, other than apparently a noted reduction in spam?

(also TIL about Entry point routing!)

Ammarpad changed the subtype of this task from "Bug Report" to "Feature Request".Apr 10 2022, 8:38 PM
TerraCodes renamed this task from enwiki doesn't redirect to short url, and instead shows bare /w/index.php to WMF wikis don't redirect to short url, and instead shows bare /w/index.php.Apr 11 2022, 12:03 AM

@TerraCodes: Why does this create a problem? Could you elaborate on your use case, please?

@TerraCodes: Why does this create a problem? Could you elaborate on your use case, please?

for the same reason T276737 exists, it doesn't match the short urls that the wiki has configured.

Krinkle closed this task as Declined.EditedApr 20 2026, 2:19 PM
Krinkle subscribed.

Regarding the task title as written ("WMF wikis don't redirect to short url"), this is part of MediaWiki. It is not specific to WMF wikis. As far as I know, there is no use case or system documentation that requires a redirect to work. What we do have, is a rich history of problems that happen if you redirect URLs:

We have, for cosmetic reasons and minor improvements in caching, carved out a safe and narrow subset of certain pageview URLs. For example, /wiki/Main Page (with a space) redirects to /wiki/Main_Page. You can find this and other examples in the test cases at ActionEntryPointTest::provideTryNormaliseRedirect.

It is expected that encountering a non-canonical "long" URL for a pageview is rare, because we never generate them ourselves (all blue links and search results point to the canonical "short" form). And just in case a search engine accidentally finds a long URL created by hand, we include <link rel=canonical> in the HTML, which is similar to a redirect, and tells the search engine to index the canonical "short" URL instead, so that the non-standard URL will not show in search results.

Regarding the task description example:

go to https://en.wikipedia.org/wiki/Wikipedia:Don%27t_delete_the_main_page
click on edit button
you get taken to https://en.wikipedia.org/w/index.php?title=Wikipedia:Don%27t_delete_the_main_page&action=edit

What should have happened instead?:
you get taken to https://en.wikipedia.org/wiki/Wikipedia:Don%27t_delete_the_main_page?action=edit

This is about the edit link, not the pageview. If the edit link should use a short URL, then it would point there directly. Generating long link, but then redirecting afterward, would be inefficient. You can learn why we intentionally prefer long URLs for actions that are not pageviews, at T276737#11838460.

I'll decline this task because the title and description both propose an outcome that is incompatible with our design requirements. Without a concrete problem, there is no action to be taken here.

If you find that part of the MediaWiki software gives you a long URL for a pageview, instead of a short URL, then that is a bug, and we will fix that. Please file a separate task if you encounter that.