How to remove the /public path from your URL in Laravel 5.2 the easiest way if you can’t or don’t want to modify the Apache document root ?
In a fresh Laravel 5.2 install, the public frontend is located in
example.com/public/index.php
To remove the /public/ part of your URL, simply copy-paste /public/index.php and /public/.htaccess to /index.php and /.htaccess.
cd your/project/folder cp public/index.php index.php cp public/.htaccess .htaccess
And of course, modify the path within index.php :
require __DIR__.'../bootstrap/autoload.php'; and $app = require_once __DIR__.'../bootstrap/app.php';
becoming :
require __DIR__.'/bootstrap/autoload.php'; and $app = require_once __DIR__.'/bootstrap/app.php';
This is by far not the best way to do it but the easiest way if you can’t modify your Apache configuration files for examples.
A better way to do it if you have to push it to a production server would be to move all your Laravel files from the project root folder in another place in your server and keep the content of the /public folder in your server root url.
Then, just update the index.php consequently.