This is weird thing from #laravel on fresh installation, so everyone wants to remove public from url, there are two different methods.
1. Method is remove public from url in #.htaccess
Create .htaccess file on main directory of laravel and put the following code
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule>
2. Method is remove public url moving files to parent path.
Go to installed laravel directory/public
move .htaccess, favicon.ico, index.php, robots.txt, web.config to laravel main directory.
open index.php which you moved from public folder to main directory.
change code from
require __DIR__.'/../bootstrap/autoload.php'; $app = require_once __DIR__.'/../bootstrap/app.php';
to
require __DIR__.'/bootstrap/autoload.php'; $app = require_once __DIR__.'/bootstrap/app.php';
-
very helpful, thank you
-
In the first step, described that create a new file .htaccess and paste code that is given. Also in the second step, mentioned that move .htaccess and other 3 files from /public directory to root of project. There is a conflict create and move .htaccess (which file is mandatory the new created file or the moved) file.