.htaccess - 500 内部服务器错误而不是 404

标签 .htaccess http-status-code-404

这是我的.htaccess

ErrorDocument 404 /404.html

但是当我输入错误的 url,例如 http://127.0.0.1:8080/myweb/wrong-url.php 时,它不会转到 404.html 并显示 500内部服务器错误 任何人都可以解释为什么?

我的错误日志中显示的错误是

AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. 
Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

最佳答案

您的 404.html 页面本身可能会生成另一个 404,因为该位置不是 /404.html,而是 /myweb/404.html。基本上它会尝试找到 404.html 文件,但找不到,这会生成另一个 404,然后尝试找到 404.html 文件,但找不到,这会生成另一个 404 等等。更改您的 .htaccess 以将 404 指向 /myweb/404.html,或将文件移动到服务器的根目录。

关于.htaccess - 500 内部服务器错误而不是 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17181671/

相关文章:

html - 针对移动设备和 CSS @font-face 进行优化

jsf - Intellij idea 新项目与 jsf 不工作

php - 在 localhost 的 php 中创建一个个性化的 404 错误页面

apache - 如何禁用目录浏览?

.htaccess - 警告 : Unnecessary HSTS header over HTTP

.htaccess - 将http重定向到https,然后将其重定向到子域的文件夹?

wordpress - 301 重定向不起作用 (WordPress) - [ URL 中带有 ?m=1 的 Probler ]

vue.js - Vue、vite:GET http://localhost:3000/@vite/client net::ERR_ABORTED 404(未找到)

seo - 关于 Google 网站管理员 404 错误的建议

php - 用于 SEO 友好 URL 的 mod_rewrite