在codeigniter重定向到500错误后的自定义html页面
问题描述:
在codeigniter中,如何在500错误发生时重定向到自定义HTML页面?在codeigniter重定向到500错误后的自定义html页面
我曾尝试以下在.htaccess的代码,但它不工作:
的ErrorDocument 500 /errors/error_500.html
error_500.html
是我的自定义HTML页面,它的位置是application/errors
答
的ErrorDocument指令,提供当本地URL路径,预计路径从DocumentRoot完全限定。在你的情况,这意味着对ErrorDocument
实际路径是
ErrorDocument 500 /path/errors/error_500.html
尝试
ErrorDocument 500 http://localhost/errors/error_500.html
当你在第二次尝试纠正它,原因你看到的页面,而不是因为http://localhost/errors/error_500.html
没有按” t存在,因此在查找错误处理文档时存在500位错误。
答
在Codeigniter中它实际上有一个自定义的500错误页面。
所以,如果你发现你得到一个通用的500错误页面意味着它可能是Apache overriding the codeiginter 500 error page
。
你也可以尝试将其覆盖在.htaccess to direct it
到自己的自定义500.html,
但随后你就会错过任何由codeiginter提供的错误信息:
ErrorDocument 500 /errors/error_500.html
您还可以编辑/application/errors/
中的codeiginter 500错误页面。我认为这是error_php.php
文件。
您是否收到任何错误讯息? –