How does MediaWiki redirect pages?
Current versions of MediaWiki have the 开发者_如何学JAVAfront page accessible via
http://www.example.com/wiki/index.php/Main_Page
Instead of the older version of
http://www.example.com/wiki/index.php?title=Main_Page
That second URL is literally how the PHP script would be called in most casual web apps, but the above URL is cleaner and more desirable. Now, I can see how that could easily be converted with an Apache mod_rewrite rule:
RewriteRule ^/index.php/(.*)$ /index.php?title=$1
But there's no htaccess file in the default MediaWiki setup. So how are they doing the redirect?
Not sure if this is what they are doing, but there no need to redirect using a .htaccess. the page index.php is found and that script is what is loaded. index.php just gets $_SERVER['REQUEST_URI'] and parses that into the query string.
http://httpd.apache.org/docs/2.0/mod/core.html#acceptpathinfo
精彩评论