Alias version should not be listed first, it shouldn't even be here at all. Alias should not be used. I've never seen the reference for Apache recommending Alias over RewriteEngine. But I have a feeling that if it exists at all it's a generic recommendation that is being mis-applied to MediaWiki.
The way Alias works is fundamentally wrong and only works because MediaWiki ignores the bad side effects that Alias introduces.
Proper rewrite rules just rewrite the path to /index.php
, without any suffix or query modifications. Basically they just tell Apache, "For this url, run index.php
without modifying anything". MediaWiki, not Apache, then reads the whole /wiki/Page
path from the raw url in $_SERVER['REQUEST_URI']
and MediaWiki parses out the "Page" page name.
That is not how Alias works. A Alias /wiki /index.php
alias actually tells apache to rewrite /wiki/Page
to /index.php/Page
and then passes "Page" to $_SERVER['PATH_INFO']
expecting you'll use PATH_INFO to get the "Page" title.
However, this is not actually a useful or good thing. Read the MediaWiki source code.
"PATH_INFO is mangled due to https://bugs.php.net/bug.php?id=31892" "And also by Apache 2.x, double slashes are converted to single slashes."
If MediaWiki actually used the PATH_INFO that you get by using an Alias instead of a RewriteRule, your wiki's urls could be broken.
The only reason that Alias rewrites work, is because MediaWiki outright ignores the PATH_INFO and takes responsibility for parsing the "Page" title out of the url in REQUEST_URI. i.e. It basically throws the extra stuff Alias does into the trash and demotes it to a basic RewriteEngine rewrite.