Default laravel access url will be http://example.com/public/. so you need to remove “public” from url to get clean urls in laravel 5. let’s check how to remove public from url in laravel.

There is two solution to remove public from url laravel :-

1. Using .htaccess :-
Add following code in your .htaccess (if not exist create a .htaccess on laravel root directory)

 RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]

2. using content moving :-

It’s a better and simple method to remove public from url laravel below are the steps to do this:-

1. Create a folder on root with named local(you can give any name).
2. Move all files except public folder in the local folder.
3. Move all the files of public to root directory and remove blank public folder.
so directory structure will be :-
Root
a. local – which have all root files except public folder
b. all files of public folder.

 laravel(root)
  -- local
     -- app
     -- boostrap
     -- .gitattributes
     -- composer.json
     -- server.php
     -- and so on ----
  -- packages
  -- .htaccess
  -- favicon.ico
  -- index.php
  -- robots.txt

4. Now time to change some paths:-

Note:- Skip step (a) to remove public from url in laravel 5.

In laravel 5 directory structure has been changed also you will not found paths.php in bootstrap so this step need to be skip for laravel 5.
a. open local/bootstrap/paths.php and find below code

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

change with below code

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

b. open index.php (on root) and find below code

require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';

change with below code

require __DIR__.'/local/bootstrap/autoload.php';
$app = require_once __DIR__.'/local/bootstrap/app.php';

Now you have all set you can access url http://example.com/ if still problem try with clear cache of browser.

Remove public from url laravel