php - Laravel 5 geting 500 error in hosting

77

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 getserver error 500

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

634

Answer

Solution:

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

People are also looking for solutions to the problem: php - MSSQL Server 2008 Conversion failed when converting date and/or time from character string Error

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.