使用.htaccess重定向到外部网站500错误

时间:2015-12-20 02:56:54

标签: apache .htaccess redirect

我正在网站上工作(scratchyone.com)。我需要将.htaccess重定向到外部页面

http://scratchywon.github.io/scratchyone.com/errors/500.html

出现500错误。我用php强迫500。

http://scratchyone.com/500/

这是我目前的代码:

ErrorDocument 500 http://scratchywon.github.io/scratchyone.com/errors/500.html

编辑:ErrorDocument 404 http://scratchywon.github.io/scratchyone.com/errors/500.html有效 现在我使用php发送500错误,页面不显示。它只显示浏览器的默认值" 500:无法显示"

1 个答案:

答案 0 :(得分:1)

.htaccess中的内部错误没有中继自定义ErrorDocument(!)并且通过PHP模拟500错误是不可能的 - 当你的脚本运行它太晚了 - 错误文档重定向由apache mod_core(!)处理而PHP只发送状态。 所以我认为你可以忘记PHP 500仿真。

尝试在main .htaccess旁边创建一个目录,然后在make中创建.htaccess

或许这会对你有所帮助: https://www.digitalocean.com/community/tutorials/how-to-configure-apache-to-use-custom-error-pages-on-ubuntu-14-04

关于500的部分提供了如何通过错误代理模拟此错误的信息。