ローカル(Mac)で複数のWordPressサイトの開発を行っており、今まではサブディレクトリーで運用していました。とあるWordpressテーマはサブディレクトリーだと都合が良くないので、サブドメインで運用することにしたところ、下のようなエラーが発生しました。
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at you@example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apacheのログには下のようなエラーが吐かれていました。
[Thu Nov 24 20:50:07.733398 2016] [core:error] [pid 49982] [client 127.0.0.1:49565] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace., referer: http://med-eng.localhost/dmm-kuchikomi/
WordPressアドレスやサイトアドレスはしっかりサブドメインに修正していましたが、一つ見落としていたところがありました。
それはWordPressインストール時に生成された
.htaccessでした。この中に、サブディレクトリーの
/med-eng/が残っていました。
1 2 3 4 5 6 7 8 |
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /med-eng/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /med-eng/index.php [L] </IfModule> |
これを以下のように修正したところエラーは発生しなくなりました。
1 2 3 4 5 6 7 8 |
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> |
ちなみに、移行時に参考にしたサイトは以下です。