Php MVC所有者-自定义500错误
我已经创建了一个MVC框架。我希望自定义我的错误(本例中为错误500) 当前在我的网站上,如果出现服务器错误,Firefox会显示一个完全空白的页面,Chrome会显示“错误500” 我想,当我的网站上有一个500错误,它显示我的自定义500页 因此,我在.htaccess中添加了Php MVC所有者-自定义500错误,php,.htaccess,Php,.htaccess,我已经创建了一个MVC框架。我希望自定义我的错误(本例中为错误500) 当前在我的网站上,如果出现服务器错误,Firefox会显示一个完全空白的页面,Chrome会显示“错误500” 我想,当我的网站上有一个500错误,它显示我的自定义500页 因此,我在.htaccess中添加了ErrorDocument 500… 这是我的.htaccess: AddDefaultCharset UTF-8 # C'EST cette ligne que je viens d'ajouter : Error
ErrorDocument 500…
这是我的.htaccess:
AddDefaultCharset UTF-8
# C'EST cette ligne que je viens d'ajouter :
ErrorDocument 500 http://example.com/500
<IfModule mod_rewrite.c>
# => pour que si in tape index, que hebergeur n'essaye pas d'aller vers index.php ou index.html
Options -Multiviews
# => activation de l'url rewitting
RewriteEngine on
# => verif que url saisi est ni un dossier, ni un fichier qui existe physiquement, ni un lien symbolique ...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
# => ... si url saisi n'existe pas physiquement, on peut faire ré-écriture
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
# => désactiver le listing des dossier "index of" sans index.php
Options -Indexes
被忽略了
有解决方案吗?这不是问题的原因,但您应该为错误文档指定根相对URL,而不是绝对URL。如果您指定一个绝对URL,那么服务器将发出一个外部重定向。您使用的是什么服务器/版本的Apache?服务器应该已经配置了一个“内部”默认500错误文档-您通常不会得到一个空响应。你是如何测试这个的?另见:
ErrorDocument 500 http://example.com/500