[英]Wordpress suppressing php error through htaccess throwing 500 error
I am suppressing php errors from front end through .htaccess
in WordPress. 我通过WordPress中的.htaccess
抑制了前端的php错误。 I want to hide the errors throwing by WordPress, if we are trying to access a file through folder structure: 如果我们尝试通过文件夹结构访问文件,我想隐藏WordPress引发的错误:
eg: www.my_site/wp-content/themes/twentyeleven/sidebar-page.php
例如: www.my_site/wp-content/themes/twentyeleven/sidebar-page.php
.htaccess snippet: .htaccess片段:
php_flag display_errors off
But, it is throwing a 500 internal server error. 但是,它引发了500个内部服务器错误。 I tried 我试过了
error_reporting(0);
ini_set('display_errors', 0);
in the header.php file, no change. 在header.php文件中,没有更改。 Is there any way to redirect to homepage if a 500 error occurred? 如果发生500错误,是否有任何方法可以重定向到首页?
Try: 尝试:
ErrorDocument 500 /index.php
That should cause any 500 error to redirect to the home page. 这将导致任何500错误重定向到主页。 The header will still have a 500 status, so it would be interesting to see how WordPress handles that. 标头仍将具有500状态,因此查看WordPress如何处理该标头将很有趣。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.