我了解你的情况。这样做
让我们考虑一下名为“网站”的主题项目
原来“网站”目录是这样的。
- app
- bootstrap
- config
- database
- public
- ...
- vendor
- .env
- artisan
- composer.json
现在这就是你需要做的。将所有内容分组到文件夹名称“网站”(您的主题项目全部或您想要的名称),但“公共文件夹”除外
你应该有这样的目录。
- website
- app
- bootstrap
- ...
- .env
- composer.json
- public
现在对于公用文件夹,将所有内容移到外面,看起来像这样。
- website
- app
- bootstrap
- ...
- .env
- composer.json
- index.php
- .htaccess
- (your assets css/js/images files)
你快到了,我们应该只需要编辑 index.php 来自
require __DIR__.'/../bootstrap/autoload.php';
到
require __DIR__.'/website/bootstrap/autoload.php'; //where website is the new foldername
和
$app = require_once __DIR__.'/../bootstrap/app.php';
到
$app = require_once __DIR__.'/wesbite/bootstrap/app.php';
现在应该可以了。并且无需通过“/public”文件夹访问即可在 goDaddy 或 cpanel 中的任何共享主机中运行网站。