MAMPでファイル実行しようとしたらInternal Server Errorが出た


駆け出せてないエンジニアの卵なりにPHPの学習をしようと思い、いつも通りMAMPにフォルダを立てて実行しようとしたら下記のエラーが

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

ーーーーーーーーーーーーーーーーーーーーーーーーーーーー

え?何これ?いきなりなんだ??と思い、とりあえずエラーログ確認

[Mon Nov 30 21:03:13 2020] [error] [client 127.0.0.1] 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.

なんかリダイレクトが10回以上失敗しまくっているみたい。

色々調べた結果、結論から書くと
htdocsの中にある.htaccessのファイルを書き換えたら直った。

[修正前(人によってコード違うかも)]

RewriteEngine on
# Uncomment if you have a .well-known directory in the root folder, e.g. for the Let's Encrypt challenge
# https://tools.ietf.org/html/rfc5785
#RewriteRule ^(.well-known/.)$ $1 [L]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.
) app/webroot/$1 [L]

[修正後]

RewriteEngine on
# Uncomment if you have a .well-known directory in the root folder, e.g. for the Let's Encrypt challenge
# https://tools.ietf.org/html/rfc5785
#RewriteRule ^(.well-known/.)$ $1 [L]
RewriteRule ^$ app/webroot/ [L]
# RewriteRule (.
) app/webroot/$1 [L]

RewriteRule (.*) app/webroot/$1 [L] が悪さしていた模様
なぜかはよくわからない、、

同じ部分で詰まった人の参考になれば嬉しいです。