Once you install laravel framework on your local machine or hosting server, by default it build all the url’s consisting public folder in them. For example in your local machine it would be like this ;

http://localhost/<virtaul folder>/public/ , In my case it was as follows

http://localhost/restaurants/public/

On your hosting server it would be like;

http://yourdomain.com/public/.

So  this is not going to be a pretty good site when it comes to SEO. URL’s should be meaningful and SEO friendly.

get rid of laravel pulblic folder
Remove laravel pulblic folder

How do we avoid the public folder from the url and make it a clean URLs for laravel projects? It is pretty simple. You can do this by moving all the contents of the public folder in to root directory. Then by changing few settings in the paths.php file and index.php file you can get rid of public folder from laravel project urls.

You can locate your paths.php file inside the bootstrap folder (laravelfolder/bootstrap/paths.php).  You can do the following changes to it;

'app' => __DIR__.'/../app' change to 'app' => __DIR__.'/app'

'public' => __DIR__.'/../public', change to 'public' => __DIR__.'/../../',

In the laravel folder you can locate the index.php file edit it as follows;

require __DIR__.'/../bootstrap/autoload.php'; change to 

require __DIR__.'/bootstrap/autoload.php';

$app require_once __DIR__.'/../bootstrap/start.php'; change to 

$app require_once __DIR__.'/bootstrap/start.php';

Save all the files and refresh the link it will show without the public folder.