Larave配置了路由却一直报 404
作者:互联网
我用的是集成环境,phpstudy_pro,所有的环境配置文件都已经调好了(phpstudy_pro会自动生成),在网上查了很久,都说是环境问题后面我一一对过没有问题,最后发现根本原因在于:
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>
标签:RewriteRule,HTTP,REQUEST,FILENAME,404,Authorization,RewriteCond,路由,Larave 来源: https://blog.csdn.net/qq_35401605/article/details/112255073