linux - 错误文档 403 不适用于子目录

标签 linux apache .htaccess http-status-code-403

我在共享主机上有这样的结构:

~/above_public_html/public_html/directory_i_want_forbidden

我有一个 ~/above_public_html/.htaccess ,其中包含以下内容:

ErrorDocument 403 /403.html
ErrorDocument 404 /404.html

当我导航到不存在的文件或文件夹时,我会弹出 404.html,没有问题。

当我导航到存在但具有 chmod 700 权限的子文件夹或文件(包括 directory_i_want_forbidden)时,我得到:

Forbidden

You don't have permission to access /directory_i_want_forbidden on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at www.mydomain.com Port 80

我需要做什么才能使 ErrorDocument 403/403.html 正常工作?

最佳答案

.htaccess 或 httpd.conf 上游有些问题。因为我使用共享主机,所以我无法控制它。此后,我启动了自己的 Amazon EC2 服务器实例,一切都按预期运行。

关于linux - 错误文档 403 不适用于子目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15150171/

相关文章:

linux - 获取具有内存使用量最多的进程的用户的脚本?

linux - Apache 反向代理配置问题

php - 禁止发布 403,在 justhost 上的 wordpress 站点

apache - Apache 中特定虚拟主机的 HTTP 到 HTTPS

ubuntu 中的 php 项目。正确路径但禁止访问

Apache 错误 "AliasMatch not allowed here"

python - 如何使用 python 变量运行多个 Linux 命令

php - 仅运行脚本一次,持续 5 分钟 (Linux)

linux - 如何在 linux 中找到两个变量的最小值

PHP 可以在网络上运行,但不能在本地 apache 上运行(linux mint)