How to remove public from your Laravel 5.1 & Laravel 5.2 Project’s URL Path



This is a short Tutorial on how you can remove public keyword from your Laravel 5 url by moving some files in your project folder.

After you setup your project using composer in the command line:

1. Create a folder in the project’s root directory named local.
2. Move all files in your root folder except the public folder, in the new local folder.
3. Now, Move all files in the public folder to your root folder and delete the empty public folder.(Make sure you copy .htaccess file as well)
4. Next, open index.php on your root folder and make the following changes:
(i) change require __DIR__.’/../bootstrap/autoload.php’;
to
require __DIR__.’/local/bootstrap/autoload.php’;
(ii) change $app = require_once __DIR__.’/../bootstrap/app.php’;
to
$app = require_once __DIR__.’/local/bootstrap/app.php’;

Note: Your artisan is now located in your local directory, so make sure you cd into local to make use of “php artisan” command.


http://www.mdpstech.com

source

Reply

Do NOT follow this link or you will be banned from the site!