简体   繁体   中英

Laravel 5 geting 500 error in hosting

I spend my evening to run my laravel application in hosting.

In localhost on mac os everything is ok, but in the hosting on ubuntu I get 500 error.

I have not any clue.

.htaccess in root

Options -Indexes

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{REQUEST_URI} !^public
  RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

# Deny accessing below extensions
<Files ~ "(\.json|\.lock|\.git)">
Order allow,deny
Deny from all
</Files>

# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]

and .htaccess in public

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteBase /
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

If I delete /public/.htaccess I get server error 500

else I get Server error The website encountered an error while retrieving http://oboi.spb.ru/. It may be down for maintenance or configured incorrectly. Server error The website encountered an error while retrieving http://oboi.spb.ru/. It may be down for maintenance or configured incorrectly.

The Condition :

  RewriteCond %{REQUEST_URI} !^public

fails because because you are missing a / before the public in your Cond pattern so the Rule is being applied on every request causing an infinite recursion.

Change the Cond pattern to

!^/public

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM