LoginSignup
1
1

More than 5 years have passed since last update.

【WordPress】WordPressのパーマリンク設定(お引越しした場合)

Last updated at Posted at 2015-12-11

問題

WordPressでサイト改修の際に、ローカル環境にお引越し。

パーマリンクが設定の変更が反映されない!
404 NOT FOUNDのエラー画面に

解決策

ズバリ:mod_rewriteの設定!

①そもそもmod_rewiteは存在するのか?
私の場合)
httpd.configファイルの

LoadModule rewrite_module modules/mod_rewrite.so

がコメントアウトになっていました!
なのでこのコメントアウトを外します。

②.htaccessファイルの# BEGIN と #ENDの間に以下を挿入

# 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

→これをすることでmod_rewriteが、WordPressのデフォルトURLを、カスタム構造に書き換える機能を持ちます!

③アパッチの再起動

sudo apachectl restart

補足)便利コマンド

find / -name mod_rewrite.so
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1