问题
I see a lot of questions about how to change the title of a MediaWiki Main Page or how to redirect it to another page, but I can't seem to find anything on how to 1) prevent MediaWiki from redirecting the main domain to the "Main Page", and 2) display a stand-alone page under the main domain.
In other words, how to do exactly what Wikipedia does when you go to www.wikipedia.org
Instead of redirecting you to "http://en.wikipedia.org/wiki/Main_Page", it displays a stand-alone custom page on the main domain (www.wikipedia.org).
How can I do that with MediaWiki?
回答1:
This isn't really a MediaWiki issue/function :) wikipedia.org is the top level domain with an own index page. en.wikipedia.org/wiki/ is the "real" article path (with /w/ as the ScriptPath). So you will be redirected to the Main page, if you open en.wikipedia.org/wiki :)
So, e.g., if your wiki installation is in domain.tld/wiki/ you just need to place your "own" webpage/opener into domain.tld/.
If a user opens domain.tld he will see your custom page, if he open domain.tld/wiki he will be redirected to domain.tld/wiki/Main_page.
Hope that helps!
回答2:
Add in .htaccess
RewriteRule ^/*$ /index.php?title=Main_Page [L,QSA]
来源:https://stackoverflow.com/questions/26283433/how-to-prevent-mediawiki-from-redirecting-the-main-domain-to-the-main-page