[英]Redirect to public/ in php artisan serve
我有一個 laravel 應用程序,我對文件夾結構進行了更改,我一直在使用 laragon 並且一切正常,但在我的本地環境和實時服務器上。
但是,當我使用 php 工匠服務時,生成的 url 不會在公共文件夾中加載資產。
例如
https://livewebsite.com // [live server] works.
https://myproject.local // [laragon] works.
http://localhost/myproject // [laragon /xampp] works
http://127.0.0.1:8000 // artisan [doesn't load assets, assets in the public directory returns 404
//e.g http://127.0.0.1:8000/public/assets/themes/cryptic/style/bgs.css would return 404
我所做的改變,
|-core
|-public
|-.htaccess
|-index.php
我已將所有 laravel 核心文件夾和文件移至核心文件夾,將 .htaccess 和 index.php 移至根目錄。
從我到目前為止的調試中,我了解到服務器內置的 laravel 將請求重定向到 index.php 文件所在的公用文件夾。
我可以進行哪些更改以使請求不發送到公用文件夾,即http://127.0.0.1:8000/public/assets/themes/cryptic/style/bgs.css
應該只允許不被重定向.
整個過程適用於各種環境,除非我使用帶有 artisan 命令的 laravel 內置 PHP 服務器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.