Laravel change public folder to public_html to Live Website
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
///////////////////////////public_html/index.php
define('LARAVEL_START', microtime(true));
require __DIR__.'/../website_files/vendor/autoload.php';
$app = require_once __DIR__.'/../website_files/bootstrap/app.php';
$app->bind('path.public', function() {
return base_path() . '/../public_html';
});
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
/////////////////////////////////////////website_files/serve.php
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
if ($uri !== '/' && file_exists(__DIR__.'/../public_html'.$uri)) {
return false;
}
require_once __DIR__.'/../public_html/index.php';
//////////////////////////////////// website_files\app\Providers\AppServiceProvider.php
public function register()
{
$this->app->bind('path.public', function() {
return base_path('../public_html');
});
}