mediawikiのデフォルト設定では例えば「アセトン」のページのURLは
https://URL/index.php?title=アセトン
となるところをwikipediaのように”index.php?title=”を省略して
https://ja.wikipedia.org/wiki/アセトン
のようにする方法。
参考にしたページ
https://www.mediawiki.org/wiki/Manual:Short_URL/Apache/ja
http://blog.bungu-do.jp/archives/3386
.htaccessの編集
DirectoryIndex index.html .ht index.htm index.php
# 書き換えエンジンを有効化
#RewriteEngine On
#RewriteBase /
#RewriteRule dir1/(.*) dir2/$1 [R,L]
# 記事の短縮URL
#RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/wiki/index.php [L]
#RewriteRule index.html index.php
# メインページへ転送
#RewriteRule ^/*$ %{DOCUMENT_ROOT}/wiki/index.php [L]
RewriteEngine on
RewriteBase /wiki/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [L,QSA]
# htmlのphpを有効に
AddHandler application/x-httpd-php .html .htm
wikiの一つ上のフォルダに保存する
LocalSettings.phpに追加
$wgScriptPath = "/wiki"; $wgScript = "$wgScriptPath/index.php"; $wgRedirectScript = "$wgScriptPath/redirect.php"; $wgArticlePath = "$wgScriptPath/$1";
