当前位置:编程学习 > php >>

关于phpcms v9的404页面实现

在phpcms 中,遇到没有的栏目或者内容,只是提示没有相应的信息,但返回的状态码依然是200,在优化上达不到效果,

那么将如何来实现,其实也简单,下面为操作步骤:

首先在网站根目录,建一个page404.php文件,


[php]
<?php 
  header('http/1.1 404 Not found');  
?> 
404页面 

<?php
  header('http/1.1 404 Not found');
?>
404页面

然后在phpcms/module/content/index.php中找到lists和show.


[php] 
if(!$catid || !$id)  
 
        header('location:/page404.php'); 
 
if(!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type']!=0) 
 
        header('location:/page404.php'); 
 
if(!$r || $r['status'] != 99)  
 
        header('location:/page404.php'); 

if(!$catid || !$id)

  header('location:/page404.php');

if(!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type']!=0)

        header('location:/page404.php');

if(!$r || $r['status'] != 99)

        header('location:/page404.php');

在lists中:

if(!isset($CATEGORYS[$catid]))

        header('location:/page404.php');

这样就可以,返回的状态码是正确的。


 

补充:web前端 , HTML/CSS  ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,