【发布时间】:2021-03-05 15:46:24
【问题描述】:
希望你们一切都好,我在 Cpanel 上部署我的 laravel 项目时遇到了问题。当我点击我的路由 URL 或根 URL 时,它会显示“404 not found”
这是根网址:https://laravel.tamimikbal.com/project1/
我已经在我的根 .htaccess 文件中编写了这段代码
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
这是 public/.htaccess 文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
【问题讨论】:
标签: laravel .htaccess laravel-8