Remove index.php or public/index.php from the URL generated.

There are two ways to do that.

First one: Create an htaccess file in the Laravel root directory. If it already exists it will have an IfModule part like given below.

<IfModule mod_rewrite.c>

<IfModule mod_negotiation.c>

Options -MultiViews

</IfModule>

Change it to this:

<IfModule mod_rewrite.c>

   RewriteEngine On

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

</IfModule>

Second way:

Move all the files and folders in your directory except the public folder to a new folder. Then move every files in the public folder to the root folder.

In the newly_created_folder/bootstrap/paths.php and index file change the paths.

In the paths.php file find the below code.

'app' => __DIR__.'/../app',

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

Change it to :

'app' => __DIR__.'/../app',

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

Similarly find the code for app in the index file and change it as given below.

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

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