How to run Laravel from root directory, not from public?

后端 未结 2 680
刺人心
刺人心 2020-12-15 02:35

By default, Laravel project is run from public directory, for this I must enter URL like as:

http://localhost/public/

How to configure Lara

2条回答
  •  庸人自扰
    2020-12-15 03:34

    •Go to mainproject/public>>

    a.  .htacess
    b.  favicon.ico
    c.  index.php
    d.  robots.txt
    e.  web.config
    

    1.cut these 5 files from the public folder, and then paste on the main project folder that’s means out side of public folder… mainproject/files

    2.Next after paste ,open index.php ,modify

    •require __DIR__.'/…/bootstrap/autoload.php';  to
    •require __DIR__.'/bootstrap/autoload.php';
    
    1. modify

      $app = require_once DIR.'/../bootstrap/app.php'; to

      $app = require_once DIR.'/bootstrap/app.php';

    you can also watch this video for better understanding----------------

    https://www.youtube.com/watch?v=GboCYqEbKN0

提交回复
热议问题