MediaWikiに書かれている方法は多すぎてどれにしようか迷っちゃうので、User:Amatanoyoが使っている方法を書いておきます。
目次 |
$wgScriptPath = "/wiki"; $wgScript = "$wgScriptPath/index.php"; $wgRedirectScript = "$wgScriptPath/redirect.php"; $wgArticlePath = "$wgScriptPath/$1";
$wgScriptPath$wgArticlePath
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA]
Wikipediaはこの方法を使っています。
$wgScriptPath = "/w"; $wgArticlePath = "/wiki/$1";
RewriteEngine On RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA] RewriteRule ^wiki/*$ /w/index.php [L,QSA] RewriteRule ^/*$ /w/index.php [L,QSA]