
(1)找到66行左右的代码
在这个后边加上代码:
- $r = $this->db->get_one(array('id'=>$id));
(2)找到220行左右的(此时是在自定义伪静态基础上的修改)
- if(!$r){
- header('location:/404.html');
- }
在这后边加上代码:
- if(isset ($_GET['catid'])){
- $catid = intval($_GET['catid']);
- }else{
- $catid=$this->_getCategoryId($_GET['dir']);
- }
此时就可以实现当栏目或者内容不存在的时候跳转到404页面,当然别忘了在根目录下添加404.html
- if(empty($catid)){
- header('location:/404.html');
- }

希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, LeCMS, ClassCMS, Fastadmin, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。