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

十年热恋 提交于 2019-11-29 02:44:48

•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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!