【发布时间】:2011-05-29 21:17:49
【问题描述】:
好的,所以我尝试使用 .htaccess 为各种错误代码设置 ErrorDocuments。它工作得很好,除了现在,以下 jQuery AJAX 代码将永远不会运行 error() 函数:
$.ajax({url: url, type: "GET", cache: false, error: function(){
alert("Looking rather erroneous, are we?");
}, success: function(html){
// ...
}
有什么建议吗?我想我知道原因:.htaccess 指出所有错误,如下所示:
ErrorDocument 404 /error.php
而/error.php 有以下内容:
<?php header("Location: /#error"); ?>
所以当它转移到index.php时,它可能会丢失404文档状态。
你有什么建议?
【问题讨论】:
标签: php ajax .htaccess http-status-code-404 errordocument