![](/img/trans.png)
[英]404 Page Not Found when run Codeigniter project inside var/www/html/ on Ubuntu 16.04 LTS?
[英]error Code 404 not found when run project from root from public run normal
在我的問題中,當我嘗試從子域根目錄調用任何路由返回 laravel 錯誤 404 未找到但是當我嘗試從子文件夾/public 運行項目時,項目運行正常,路由調用正常
例如:當我打電話給 url 時: www.example.com/myprojectroot返回:404 not found like screenshot enter image description here
但是,當我從 url 調用任何路由時: www.example.com/myprojectroot/public/anydefine路由 在這種情況下,路由調用正常但某些資產無法正常工作
所以我需要從主根而不是子文件夾 public 調用任何路由我該怎么做
這是我在子域根目錄上的 .htaccess 代碼
`
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
我嘗試更改 .HTACCESS 但返回 403 FORBIDDEN
我認為您正在使用 Apache。嘗試將其添加到其配置中(通常在此處 /etc/httpd/conf/httpd.conf)
<Directory /var/www/yourproject/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
而且你還需要啟用漂亮的網址(我認為你的 laravel 版本是舊的) https://laravel.com/docs/5.0/configuration#pretty-urls
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.