phpcms配置404页面

phpcms访问不存在的页面需要释放404状态码。网上的教程都尝试过,测试成功,但会影响某些页面的访问状态码。

自己测试后发现可以直接在content里修改message.html页面来实现本功能。

修改message.html,具体代码如下:

<?php
header('HTTP/1.1 404 Not Found');
header("status: 404 Not Found");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="none" />
<title><?php echo L('message_tips');?></title>
</head>
<body>
<h2>{$msg}</h2><br/>
<a href="https://www.wentiyi.com/">返回首页 ></a><br/>
{if $url_forward=='goback' || $url_forward==''}
<a href="javascript:history.back();" >返回上页 </a>
{elseif $url_forward=="close"}
<input type="button" name="close" value=" 关闭 " onClick="window.close();">
{elseif $url_forward=="blank"}

{elseif $url_forward}
<a href="{strip_tags($url_forward)}">如果您的浏览器没有自动跳转,请点击这里</a>
<script language="javascript">setTimeout("redirect('{strip_tags($url_forward)}');",{$ms});</script> 
{/if}
{if $dialog}
<script style="text/javascript">
window.top.location.reload();window.top.art.dialog({id:"{$dialog}"}).close();
</script>
{/if}
<script style="text/javascript">
    function close_dialog() {
        window.top.location.reload();window.top.art.dialog({id:"<?php echo $dialog?>"}).close();
    }
</script>
</body>
</html>

 

posted @ 2020-11-24 16:32  MRtanchen  阅读(185)  评论(0编辑  收藏  举报