Home > Backend Development > PHP Tutorial > Customizing the header 404 status error page in php_PHP tutorial

Customizing the header 404 status error page in php_PHP tutorial

WBOY
Release: 2016-07-13 17:15:36
Original
1025 people have browsed it

The 404 page is a way to tell the search engine that this page does not exist. It also prompts the user to choose other operations. Now I will introduce the operation method of customizing the 404 page in PHP to friends who do not have apache operation permission.

Method 1

The code is as follows
 代码如下 复制代码

@header("http/1.1 404 not found");
@header("status: 404 not found");
echo 'echo 404';
exit();

Copy code

 代码如下 复制代码


@header("http/1.1 404 not found");
@header("status: 404 not found");
include("../../404.htm");
exit();

@header("http/1.1 404 not found");

@header("status: 404 not found");
echo 'echo 404';

exit();
 代码如下 复制代码

errordocument 404 /404.html

Loads a 404 error page
 代码如下 复制代码
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 xxxxxxx
@header("http/1.1 404 not found"); @header("status: 404 not found");
The code is as follows

Copy code
 代码如下 复制代码
ErrorDocument 404 /404.htm
include("../../404.htm"); exit();

You can also add the .htaccess code to your site as follows
The code is as follows Copy code
errordocument 404 /404.html If we have apahce configuration permission, we can modify httpd.conf
Found:
The code is as follows Copy code
#ErrorDocument 500 "The server made a boo boo ." #ErrorDocument 404 /missing.html #ErrorDocument 404 "/cgi-bin/missing_handler.pl" #ErrorDocument 402 xxxxxxx Modify to http://www.bkjia.com/PHPjc/628782.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/628782.htmlTechArticleThe 404 page tells the search engine that this page does not exist, and also prompts the user to choose other operations. Now let me introduce customization in php to friends who do not have apache operating rights...
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template