These are the reconfiguration instructions to make Laravel use a public_html
folder instead of a public
folder.
-
Rename the
public
folder topublic_html
-
Create a new file in de
./app
directory calledBootstrapper.php
with the followign contents:
<?php
namespace App;
class Bootstrapper extends \Illuminate\Foundation\Application
{
public function publicPath()
{
$path = $this->basePath . DIRECTORY_SEPARATOR . 'public_html';
return $path;
}
}
- In the
./bootstrap/bootstrapper.php file
, use this new bootstrapper like so:
$app = new \App\Bootstrapper(
realpath(__DIR__ . '/../')
);
- In the
./app/Providers/AppServiceProvider.php
'sregister()
method, bind the public_html directory to the container, like so:
$this->app->bind('path.public', function () {
return base_path() . '/public_html';
});
- If you are using Laravel Mix, you need to also bind the public folder in the
webpack.mix.js
file like so:
mix.setPublicPath('public_html');
- Finally, this is completely optional if you are using Dockerhero (https://github.com/johanvanhelden/dockerhero), replace the public path in the
./server.php
file, like so:
if ($uri !== '/' && file_exists(__DIR__ . '/public_html' . $uri)) {
return false;
}
require_once __DIR__ . '/public_html/index.php';