自定义500错误页面无法使用htaccess文件

时间:2018-10-16 14:39:19

标签: php apache error-handling

我有一个自定义500错误页面,但它无法正常工作。当我故意让服务器抛出500错误以进行测试以查看其是否显示我的自定义页面时,它将显示正常的默认页面。我的404错误页面正常运行。这是我的.htaccess文件。我正在运行LAMP堆栈。

#remove php file extension-e.g. https://example.com/file.php will become https://example.com/file
RewriteEngine on 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ /$1.php [L]

#Custom 400 errors - Bad request
ErrorDocument 400 /errorPages/400.php

#Custom 403 errors - forbidden
ErrorDocument 403 /errorPages/403.php

#Custom 404 errors - not found
ErrorDocument 404 /errorPages/404.php

#Custom 500 errors - internal server
ErrorDocument 500 /errorPages/500.php

我遇到了这个问题Custom 404 and 500 errors not working,但没有帮助我。我遇到了与该问题相同的错误。任何协助都会很酷。谢谢

0 个答案:

没有答案