AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > PHP编程

phpcms v9 404页面建立实现方法

51自学网 2016-09-26 http://www.51zixue.net
在phpcms中,遇到没有的栏目或者内容,只提示没有相应的信息,但返回的状态码依然是200,在优化上达不到效果,如何建立404页面呢?操作方法如下:
 
首先在网站根目录新建一个404.html或404.php页面,下面示例引用的是404.html。然后在phpcms/module/content/index.php中找到lists()和show()方法,修改方法如下:
 
show()方法中修改:
1、//if(!$catid || !$id) showmessage(L('information_does_not_exist'),'blank');
if(!$catid || !$id) header('location:/404.html');
 
2、//if(!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type']!=0)  showmessage(L('information_does_not_exist'),'blank');
if(!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type']!=0) header('location:/404.html');
3、//if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank');
if(!$r || $r['status'] != 99) header('location:/404.html');
 
 
lists()方法中修改:
//if(!isset($CATEGORYS[$catid])) showmessage(L('category_not_exists'),'blank');
if(!isset($CATEGORYS[$catid])) header('location:/404.html');


说明
:本教程来源互联网或网友上传或出版商,仅为学习研究或媒体推广,51zixue.net不保证资料的完整性。
 
上一篇:phpcms v9 针对百度优化(seo)标题分隔符  下一篇:PHPCMS V9 调用随机文章标签实例详解