Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel giving 500 internal error on Shared hosting

I have an laravel app working fine on my local machine. I have just transferred it to my server (Shared hosting) and put everything on a public folder in public_html and everything else in one step above public_html. The problem is now it shows 500 internal error on every route. I have changed .htaccess code to given code on documentation, folder rights to storage and bootstrap are set to 777.

Nothing in error logs and also nothing in laravel log files. when I installed fresh laravel installation it worked on the server as well. Tried updated code with my project but still 500 internal error.

like image 226
Arbaz Avatar asked Dec 14 '25 08:12

Arbaz


1 Answers

For Laravel 8 / IONOS Managed Server this works for me:

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

    RewriteBase /
    Options +FollowSymLinks
    RewriteEngine On

    # 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]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
like image 125
Mike Avatar answered Dec 15 '25 22:12

Mike



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!