In this post we are going to explain how to solve 500 error shows when accessing routes on a shared host, in my case IONOS. If you want the solution, jump directly at the end of this article and leave a nice comment if it fixed the issue! 🙂

The Laravel application seems to be working fine, as the homepage loads without any problem, but unfortunately, when I try to access any route (apart from the homepage), I receive the following error:

Internal Server Error

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

Please contact the server administrator, 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.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

When trying to investigate the above you will notice that NO error has been recorded in the Laravel log (storage/logs/laravel.log). After some digging I actually realized that the error was produced by the apache server and not by Laravel itself, and that was the main reason why Laravel was not producing any log on a 500 error.

The fix to the above problem is quite simple. We need to add a simple extra config within the .httpaccess file located within the public folder.


RewriteBase /

You will have to add the above straight after the RewriteEngine on line, so that your file should look like this (this is from a Laravel 8 installation:

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

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

After this change your routes work normally. This change does not need any restart, and just a simple browser refresh should solve the issue for you.

I hope the above will solve your issues, and please add a nice comment below to help other people finding this post.

TLTR; Just add RewriteBase / in the .HTTPACCESS file right after RewriteEngine on and the problem should be solved!