サブディレクトリにWordpressをインストールした時に自動的に作られる.htaccessの中身をいつも忘れてしまうので、メモしておきます。
サブディレクトリにインストールしたwordpressの.htaccessが、直下にインストールした.htaccessになっていると、投稿や固定ページが404になります。
サブディレクトリにインストールしたWordpressで突然、404になってしまった場合は、.htaceessが正しいかどうか確認してみるといいかもしれません。
直下にインストールした場合
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
サブディレクトリ(/wp/)にインストールした場合
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
# END WordPress