Home CMS Tutorial PHPCMS How to configure 404 in phpcms

How to configure 404 in phpcms

Jan 02, 2020 am 09:45 AM
phpcms

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

How to configure 404 in phpcms

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

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

<?php header('http/1.1 404 Not found');  ?>
Copy after login

或:

<?php header( $_SERVER['SERVER_PROTOCOL']." 404 Not Found", true, 404 );  ?>
Copy after login

或:

<?php  header( $_ENV['SERVER_PROTOCOL']." 404 Not Found", true, 404 );  ?>
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!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What framework is phpcms? What framework is phpcms? Apr 20, 2024 pm 10:51 PM

What framework is phpcms?

How to jump to the details page in phpcms How to jump to the details page in phpcms Jul 27, 2023 pm 05:23 PM

How to jump to the details page in phpcms

WeChat Login Integration Guide: PHPCMS Practical Combat WeChat Login Integration Guide: PHPCMS Practical Combat Mar 29, 2024 am 09:18 AM

WeChat Login Integration Guide: PHPCMS Practical Combat

The latest phpcms video tutorial recommendations in 2023 (must learn for secondary development) The latest phpcms video tutorial recommendations in 2023 (must learn for secondary development) Oct 25, 2019 pm 03:45 PM

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

What database does phpcms use? What database does phpcms use? Feb 21, 2023 pm 06:57 PM

What database does phpcms use?

How to change the site name in phpcms How to change the site name in phpcms Feb 24, 2023 am 09:29 AM

How to change the site name in phpcms

How to implement WeChat login in phpcms How to implement WeChat login in phpcms Mar 09, 2023 am 09:33 AM

How to implement WeChat login in phpcms

Does phpcms have a comment function? Does phpcms have a comment function? Feb 16, 2023 am 10:06 AM

Does phpcms have a comment function?

See all articles