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

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools