自定义404和500错误不起作用 [英] Custom 404 and 500 errors not working

查看:149
本文介绍了自定义404和500错误不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法自定义404和500错误页面。尝试直接访问或通过错误访问时,两个页面都出现以下错误:
错误img

Got custom 404 and 500 error pages which don't work. I'm given the following error for both pages, when trying to access directly or via error: error img

.htaccess内容:

.htaccess content:

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

ErrorDocument 404 /error_docs/404.php
ErrorDocument 500 /error_docs/500.php

错误页面均包含:

<p>text</p>

我已经检查了两条路径,并且它们都是正确的。
如果我将文件路径替换为文本,则显示该文本,并且该错误起作用。
谢谢。

I've checked both paths several times and they are correct. If i substitute the file paths for text, the text is displayed and the error works. Thanks.

推荐答案

删除此行,最后就可以了

Remove this line and finally you are ready

RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

这篇关于自定义404和500错误不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆