ラボ > FuelPHP:エラー絡み、サーバ:.htaccess、Xampp

FuelPHP+Xampp(VirtualHost)で500エラー(リダイレクトのやりすぎ)

「Request exceeded the limit of 10 internal redirects due to probable configuration error.」が出てきた。

作成日:2021-02-16, 更新日:2021-02-16

経緯

1.Xampp+FuelPHP(VirtualHost)で環境構築
2.VirtualDocumentRoot(?)を使うようになった
3.TOPページ以外が500エラーになった

▼そのときのエラーログに出力されていた内容

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.

→リダイレクトのやりすぎで怒られている。

1.Xampp+FuelPHP(VirtualHost)で環境構築

このときは問題なかった。
このときの設定は下記のような感じ。

・「httpd-vhosts.conf」に「hoge.localhost」「foo.localhost」などを任意のディレクトリに紐づけ
・「hosts」に「hoge.localhost」「foo.localhost」を記載

このときのメモ:Xamppでサブドメインを使う(hosts、httpd-vhosts.conf)

2.VirtualDocumentRoot(?)を使うようになった

「hoge.localhost」「foo.localhost」などを一括設定できるというコトで設定

・「httpd-vhosts.conf」に「hoge.localhost」「foo.localhost」などの設定を削除
・「httpd-vhosts.conf」に「*.localhost」でドメイン指定して「VirtualDocumentRoot "〇〇〇\%1\htdocs"」みたいな感じで設定
・「hosts」から「hoge.localhost」「foo.localhost」を削除
など

このときのメモ:Xamppでサブドメインを使う(hosts、httpd-vhosts.conf):簡易版

対応

・「.htaccess」に「RewriteBase」を追加

▼「RewriteEngine on」の下に「RewriteBase /」を追加

~略~
RewriteEngine on
RewriteBase /
~略~

http://〇〇.localhost/hogeの場合

・「RewriteBase /」を「RewriteBase /hoge/」に変更

http://〇〇.localhost/の場合

・「RewriteBase /」のままでOK

関連項目

Xamppでサブドメインを使う(hosts、httpd-vhosts.conf)
Xamppでサブドメインを使う(hosts、httpd-vhosts.conf):簡易版