且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

返回 404 错误的 Apache 自定义 404 页面

更新时间:2022-05-10 08:23:14

我很快就想到了:

<?
 header("HTTP/1.1 404");
 echo "ERROR"; // Put the contents of your 404 page here.
?>

我在 Chrome 中检查过,这将在页眉中返回 404 代码,让您可以在页面的其余部分写入任何您想要的内容.只需将 header 函数放在页面的开头即可.

I checked it in Chrome, and this will return a 404 code in the header, and let you write whatever you'd like to the rest of the page. Just put the header function at the beginning of the page.