Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Bogey's avatar
Level 1

500 Internal Error when publishing laravel in hostinger

I uploaded the laravel app outside of public_html in my project folder as per their knowledgebase tutorial and updated the .htaccess and index.php URLs and I've cleared all of my cache many times. I've also ran php artisan route:cache to no avail. My main site.com index page works (home page) which is served by laravel, but if I click on any of the links to visit a different page, I get 500 Internal Server Error... I don't really know what to do to fix it.

0 likes
6 replies
JaiveerChavda's avatar

You can check using two ways

  1. see your laravel.log (if you can) file for what issue is causing 500 error. Or
  2. change the app_env to local and app_debug to TRUE just to check what is going on And after you solve your error. Undo to original.
1 like
Bogey's avatar
Level 1

@jaiveersinghchavda I've tried all that, no errors show and laravel.log is empty yet 500 internal server error for every page except for the home page.

1 like
shariff's avatar

which laravel version are you using? Can you show your server.php or index.php file?

Bogey's avatar
Level 1

@shariff I've started off with laravel 10.x and since than being updating it VIA composer. I don't have server.php (at least I can't find it... don't know where it should be) and my index file is:

<?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

if (file_exists($maintenance = __DIR__.'/../project/storage/framework/maintenance.php')) {
    require $maintenance;
}

require __DIR__.'/../project/vendor/autoload.php';

$app = require_once __DIR__.'/../project/bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
    $request = Request::capture()
)->send();

$kernel->terminate($request, $response);

'project' is the laravel project folder where the laravel application is (located in the parent directory of 'public_html') and the contents of 'public' is in 'public_html'.

The home page works, but any other link throws an error 500

Bogey's avatar
Level 1

I fixed the issue. Hostinger's Knowledgebase told me to add a rewrite rule to .htaccess that I shouldn't have. Reverting the .htaccess back to the original laravel's .htaccess and clearing all cookies and cache fixed the issue.

3 likes

Please or to participate in this conversation.