Manual:Short URL/Page title -- Windows & Apache without 403 on Special Pages
File:OOjs UI icon clock-destructive.svg | Warning: This Short URL page contains bad advice on how to configure your server that could lead to some pages on your wiki not working and/or may cause you issues while upgrading. All pages on how to configure short URLs on Apache have been replaced with Manual:Short URL/Apache . This guide remains simply because there is one special case in this page that has not yet been accounted by that manual page. |
Because the colon character is used by NTFS to denote symbolic links, when http://example.com/Special:SpecialPages is accessed, Windows looks for a non-existent symbolic link in the document root for example.com. This generates a 403 error.
Including an .htaccess file in the document root does not resolve the problem because the error occurs before the .htaccess file is parsed. To prevent the error from occurring, the colon character must be addressed in an appropriate .conf file.
Step 1
If you have vHosts configured, insert the following Rewrite directives into the appropriate <VirtualHost>
directive.
Otherwise, insert it in the <directory>
directive for your wiki's root directory:
RewriteEngine On RewriteRule ^/(.*):(.*) /index.php/$1:$2
Step 2
Edit your LocalSettings.php file to include:
$wgArticlePath = "/$1";
Notice
It should be noted that this method of Pretty URLs is not currently compatible with pretty action URLs (e.g. /action/edit/Main_page). MediaWiki assumes that anything in the path (aside from the domain) is a page title, causing a recursion loop that results in attempts to edit /Main_page instead creating a new page named /action/edit/Main_Page. This issue is confirmed in v.1.15.1.
Step 3
Add these rules to the .htaccess file in your root directory.
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) /index.php/$1 [L,QSA]
Conclusion
The rewrite rules in the .conf file invisibly translates http://example.com/Special:SpecialPage to http://example.com/index.php/Special:SpecialPage. Then the .htaccess file translates it back to http://example.com/Special:SpecialPage for processing.