LoginSignup
0
2

More than 3 years have passed since last update.

Laravel6ををさくらのライトプランにアップしたら500エラーが止まらない

Posted at

Internal_Server_Error.png

ローカルで作成したLaravelのプロジェクトをさくらのライトプランのサーバにアップしたらInternal Server Errorが出た。

まず解決法

.htaccessが原因。RewriteBase /を追記すると直った。

public/.htaccess
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On
    RewriteBase / # ←これを追加

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

調べ方

・トップページは表示できて、それ以外のページが見られない。cssなどの存在するファイルは表示できる。
→ .htaccessが原因かなぁとあたりをつける。

・.htaccessを削除してファイルの存在しないURLにアクセスすると500エラーが404エラーに。
→ .htaccessでほぼ確定。

・さくらのコントロールパネル > アプリケーションの設定 > アクセスログの設定 > エラーログ からエラーを確認。

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.

→ Rerwiteで無限ループしているっぽいので修正。

0
2
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
0
2