While adding some redirect tests for T357436 (https://gerrit.wikimedia.org/r/c/operations/puppet/+/1003525), I came across some mildly surprising redirect behavior involving paths prefixed with /wiki.
In short:
- https://donate.wikimedia.org/blah -> 404
- https://donate.wikimedia.org/wikiblah -> 301 (location: https://foundation.wikimedia.org/wiki/Home)
This seems to result from a combination of:
- the RewriteRule at https://gerrit.wikimedia.org/r/plugins/gitiles/operations/puppet/+/1dfae2f64dce3d769798110d2ccfbf80af6111e0/modules/mediawiki/templates/apache/mediawiki-vhost.conf.erb#51 matching /wikiblah and
- donatewiki's /w/index.php itself serving the redirect
It's #1 that's the surprising part.
Chatting with @RLazarus a bit, it seems like the intention was probably for this to match something a bit more restrictive (e.g., matching ^/wiki(/.*)?$).
The purpose of this task is to investigate whether that was indeed the intent and if so, whether it is safe to restrict the match pattern.