How to configure 404 in phpcms
Jan 02, 2020 am 09:45 AMPHPCMS是一款网站管理软件。该软件采用模块化开发,支持多种分类方式,使用它可方便实现个性化网站的设计、开发与维护。它支持众多的程序组合,可轻松实现网站平台迁移,并可广泛满足各种规模的网站需求。
在phpcms v9系统中设置404错误页的方法:
1、在网站根目录,建一个page404.php文件,内容为:
<?php header('http/1.1 404 Not found'); ?>
或:
<?php header( $_SERVER['SERVER_PROTOCOL']." 404 Not Found", true, 404 ); ?>
或:
<?php header( $_ENV['SERVER_PROTOCOL']." 404 Not Found", true, 404 ); ?>
2、在函数库中定义404页面。
修改phpcms/libs/functions/global.fnc.php,最后位置,插入:
function page404(){ header($_SERVER['SERVER_PROTOCOL']." 404 Not Found", true, 404 ); require('page404.php'); exit(); }
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()
lists方法:
if(!isset($CATEGORYS[$catid])) page404()
这样修改,当碰到上面的情况就会返回状态码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!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to jump to the details page in phpcms

WeChat Login Integration Guide: PHPCMS Practical Combat

The latest phpcms video tutorial recommendations in 2023 (must learn for secondary development)

How to change the site name in phpcms

How to implement WeChat login in phpcms
