SIGN IN
Harry Dharma Putra
Think Simple, Make It Simple, It Won't Be So Complicated
Contact
Whatsapp
Email

Laravel Menampilkan White Screen Saat Di Upload Ke Shared Hosting

01 May 2021

Cara mengatasi website berbasiskan framework Laravel menampilkan layar putih kosong (white screen) tanpa pesan kesalahan (error) saat di upload ke shared hosting.

1. Pastikan penulisan path direktori pada file index.php di folder public_html telah terarah ke file autoload.php dan file app.php dengan benar.

require __DIR__.'/../path/vendor/autoload.php';
$app = require_once __DIR__.'/../path/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

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

$app->bind('path.public', function() {return __DIR__;});


2. Ganti penulisan pada .htaccess menjadi seperti tertulis dibawah ini.

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

    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]

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