Apache配置Laravel报You don't have permission to access this resource

Apache配置Laravel报:You don’t have permission to access this resource.

当你配置完Apache后,就在你输入域名时,很好,没啥问题,但,就当你敲下回车键的这一瞬间,就在这一瞬间出现了这个东西:
You don’t have permission to access this resource.
在这里插入图片描述

解决方案

Apache 服务器

Laravel框架通过设置 public/.htaccess 文件去除链接中的index.php。 如果你你的服务器使用的是Apache,请开启mod_rewrite 模块。

如果框架附带的 .htaccess 文件在你的Apache环境中不起作用,请在.htaccess后面添加:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

成功之后出现这个页面

在这里插入图片描述

发布了22 篇原创文章 · 获赞 16 · 访问量 1609

猜你喜欢

转载自blog.csdn.net/qq_43098197/article/details/104672286