Manual:Short URL/Page title -- Windows & Apache without 403 on Special Pages/ja

From mediawiki.org
This page is a translated version of the page Manual:Short URL/Page title -- Windows & Apache without 403 on Special Pages and the translation is 17% complete.

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.

ステップ 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

ステップ 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.

ステップ 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.