我有一个从GitHub中获取的Laravel项目,它在localhost上正常工作,但它不能在服务器上发出403错误,index.php文件在公共目录中。
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
如果我把index.php放在root中,它的工作原理是css和js文件不能正常工作。
谢谢
在您的Web服务器上,主目录必须指向公共目录。在Froxlor上是DocumentRoot:path / to / public / On cPanel是Root dir(在我的例子中)
您也可以将索引文件放在根目录中,但不建议这样做,因为您必须改变路径。这就是你的css和js文件无法正常工作的原因。