54 lines
1.9 KiB
PHP
54 lines
1.9 KiB
PHP
<?php
|
|
|
|
use Illuminate\Contracts\Http\Kernel;
|
|
use Illuminate\Http\Request;
|
|
|
|
define('LARAVEL_START', microtime(true));
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Check If The Application Is Under Maintenance
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
if (file_exists($maintenance = __DIR__.'/storage/framework/maintenance.php')) {
|
|
require $maintenance;
|
|
}
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Register The Auto Loader
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
require __DIR__.'/vendor/autoload.php';
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Run The Application
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
|
|
|
// Jika aplikasi ditempatkan di subfolder (mis. https://domain/E31231762),
|
|
// strip prefix path dari REQUEST_URI agar Laravel menerima rute relative root.
|
|
$appUrl = getenv('APP_URL') ?: ($_SERVER['APP_URL'] ?? null);
|
|
if ($appUrl) {
|
|
$basePath = parse_url($appUrl, PHP_URL_PATH) ?: '';
|
|
if ($basePath && strpos($_SERVER['REQUEST_URI'] ?? '', $basePath) === 0) {
|
|
$_SERVER['REQUEST_URI'] = substr($_SERVER['REQUEST_URI'], strlen($basePath)) ?: '/';
|
|
if (isset($_SERVER['SCRIPT_NAME']) && strpos($_SERVER['SCRIPT_NAME'], $basePath) === 0) {
|
|
$_SERVER['SCRIPT_NAME'] = substr($_SERVER['SCRIPT_NAME'], strlen($basePath)) ?: '/index.php';
|
|
}
|
|
if (isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], $basePath) === 0) {
|
|
$_SERVER['PHP_SELF'] = substr($_SERVER['PHP_SELF'], strlen($basePath)) ?: '/index.php';
|
|
}
|
|
}
|
|
}
|
|
|
|
$kernel = $app->make(Kernel::class);
|
|
|
|
$response = $kernel->handle(
|
|
$request = Request::capture()
|
|
)->send();
|
|
|
|
$kernel->terminate($request, $response);
|