I have tried to search for tutorial to move the public folder, but from all the guide it seems like the code is different than version 11. The folder structure I want to move will be like:
I have modified the public/index.php file to be:
<?php
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../program/storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../program/vendor/autoload.php';
// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../program/bootstrap/app.php')
->handleRequest(Request::capture());
However, when I try to run php artisan serve
, I get the error
Symfony\Component\Process\Exception\RuntimeException
The provided cwd "C:\wamp64\www\my-project\program\public" does not exist.
What are the things needed to modify to get it works?
To make artisan use a custom public folder, you can edit the artisan script to call the usePublicPath()
method on the application object.
Change these lines:
$status = (require_once __DIR__.'/bootstrap/app.php')
->handleCommand(new ArgvInput);
to:
$status = (require_once __DIR__.'/bootstrap/app.php')
->usePublicPath('/your/public/folder')
->handleCommand(new ArgvInput);