laravel或者Thinkphp定义了路由访问出现404的解决方法

上面说的这种情况一般是 没有在url上面加index.php所导致的 一般我们的框架搭建完毕之后会生成一个.htaccess的文件 在该文件中加入以下代码即可

// 去除index.php的后缀
<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{
    
    REQUEST_FILENAME} !-d
  RewriteCond %{
    
    REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>

猜你喜欢

转载自blog.csdn.net/weixin_43944691/article/details/111029283