这是我的.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/