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

后端 未结 2 676
刺人心
刺人心 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:24

    Setup your webserver (probably Apache or NginX) to use the public folder of your laravel app as root directory. Or use a public_html folder and symlink it to your public folder, which basically does the same.

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题