Trigger 500 Internal Server Error in PHP and display Apache error page

前端 未结 9 1061
一整个雨季
一整个雨季 2020-12-25 11:30

How can i trigger 500 Internal Server Error or 404 Page Not Found Apache errors in PHP?

For 500 Internal Server Error i have tried

9条回答
  •  一整个雨季
    2020-12-25 12:01

    After such a knowledge-full discussion, i think there is no php code can display the by default 500 Internal Server Error. The solution is :
    1. Create a folder named http500 next to the php file.
    2. Create a .htaccess file in it and add following code :

    
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^])(.(*/
        RewriteRule ^])((a-zA
    
    
    1. PHP redirect code :

    header('location : http500/');

提交回复
热议问题