Home> CMS Tutorial> PHPCMS> body text

How to configure 404 in phpcms

Release: 2020-01-02 09:45:53
Original
3827 people have browsed it

PHPCMS是一款网站管理软件。该软件采用模块化开发,支持多种分类方式,使用它可方便实现个性化网站的设计、开发与维护。它支持众多的程序组合,可轻松实现网站平台迁移,并可广泛满足各种规模的网站需求。

How to configure 404 in phpcms

在phpcms v9系统中设置404错误页的方法:

1、在网站根目录,建一个page404.php文件,内容为:

Copy after login

或:

Copy after login

或:

Copy after login

2、在函数库中定义404页面。

修改phpcms/libs/functions/global.fnc.php,最后位置,插入:

function page404(){ header($_SERVER['SERVER_PROTOCOL']." 404 Not Found", true, 404 ); require('page404.php'); exit(); }
Copy after login

3、在phpcms/module/content/index.php中找到lists和show方法,修改插入:

show方法:

if(!$catid || !$id) page404() if(!isset($CATEGORYS[$catid]) || $CATEGORYS[$catid]['type']!=0) page404() if(!$r || $r['status'] != 99) page404()
Copy after login

lists方法:

if(!isset($CATEGORYS[$catid])) page404()
Copy after login

这样修改,当碰到上面的情况就会返回状态码404。

PHP中文网,大量的免费PHPCMS教程,欢迎在线学习!

The above is the detailed content of How to configure 404 in phpcms. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!