if (strstr($_SERVER['REQUEST_URI'],'index.php')) {
header('HTTP/1.0 404 Not Found');
}
为什么这个不起作用?我得到了一张空白页。
发布于 2009-01-12 22:37:49
if (strstr($_SERVER['REQUEST_URI'],'index.php')){
header('HTTP/1.0 404 Not Found');
echo "<h1>404 Not Found</h1>";
echo "The page that you have requested could not be found.";
exit();
}
如果你看最后两行回声,你就会看到内容。您可以随心所欲地对其进行自定义。
发布于 2012-10-07 15:20:35
对于记录,这是全大小写处理程序:
<?php
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
header("Status: 404 Not Found");
$_SERVER['REDIRECT_STATUS'] = 404;
?> <!-- 404 contents below this line -->
发布于 2011-06-08 20:01:18
加载默认服务器404页面,如果您有一个,例如为apache定义的:
if(strstr($_SERVER['REQUEST_URI'],'index.php')){
header('HTTP/1.0 404 Not Found');
readfile('404missing.html');
exit();
}
https://stackoverflow.com/questions/437256
复制相似问题