index.phpとindex.htmlがある環境

既に稼働中のWebサイト(index.html)があり、新規にWordPress(index.php)を導入する場合、index.htmlとindex.phpが共存する環境になります。

.htaccessやサーバの設定にもよるかと思いますが、index.htmlが優先されるため既存のWebサイトが表示されます。
手動でindex.phpを入力すればWordPressのトップページが表示されそうですが、WordPress2.8で上手くいきませんでした。
どうしても、既存Webサイト(index.html)が表示されてしまいます。

検索したところ、WordPress2.7から調整が必要になったようです。

ご参考
 ・wordpress2.7でindex.htmlがある場合にリダイレクトしてしまう問題 » wordpressMUで作る!
 ・Changeset 9203 – WordPress Trac

修正するのは“wp-includes/canonical.php”内の2か所

■1か所目
・修正前

// Some PHP setups turn requests for / into /index.php in REQUEST_URI
// See: http://trac.wordpress.org/ticket/5017
// See: http://trac.wordpress.org/ticket/7173
// Disabled, for now:
// $original['path'] = preg_replace(’|/index\.php$|’, ‘/’, $original['path']);

・修正後

// Some PHP setups turn requests for / into /index.php in REQUEST_URI
$original['path'] = preg_replace(’|/index\.php$|’, ‘/’, $original['path']);

■2か所目
・修正前

// trailing /index.php
$redirect['path'] = preg_replace(’|/index.php/*?$|’, ‘/’, $redirect['path']);

・修正後

// trailing /index.php/
$redirect['path'] = preg_replace(’|/index.php/$|’, ‘/’, $redirect['path']);

これで、解決しました。