Method I : Using .htaccess
Adding the following code to htaccess:
RewriteEngine On RewriteRule ^(.*)$ public/$1 [L]
Method II : Moving the contents of public folder to root directory
Make a new folder laravelfiles in your root directory and move all the files and folder except public directory to laravelfiles. And move everything of public directory to root folder.
Now we have to change the paths in laravelfiles/bootstrap/paths.php file and index.php.
Find these lines in laravelfiles/bootstrap/paths.php
'app' => __DIR__.'/../app', 'public' => __DIR__.'/../public',
Change these two lines to:
'app' => __DIR__.'/../app', 'public' => __DIR__.'/../../',
Find these lines in index.php
require __DIR__.'/../bootstrap/autoload.php'; $app = require_once __DIR__.'/../bootstrap/start.php';
And change to:
require __DIR__.'/laravelfiles/bootstrap/autoload.php'; $app = require_once __DIR__.'/laravelfiles/bootstrap/start.php';