Unitrai

How to Remove public from url laravel framework 5.x

5 June 2020

Create a DIR in your laravel app root and name it "myapp", you can name it anything you like. Move everthing except public DIR from your root directory to newly created DIR "myapp"  Move everthing from public DIR to root, now public folder will become empty. Your root structure will become like atta

  • Create a DIR in your laravel app root and name it "myapp", you can name it anything you like.
  • Move everthing except public DIR from your root directory to newly created DIR "myapp" 
  • Move everthing from public DIR to root, now public folder will become empty.
  • Your root structure will become like attached image.
  • Edit your index.php as below:
    • change require __DIR__.'/../bootstrap/autoload.php';  to require __DIR__.'/myapp/bootstrap/autoload.php';
    • Change $app = require_once __DIR__.'/../bootstrap/app.php';  to $app = require_once __DIR__.'/myapp/bootstrap/app.php';
   
   
#Web

Share this post