PHP Header custom 404 Status error page _php tutorial

Source: Internet
Author: User
404 page is a tell the search engine this page does not exist, but also prompted the user can choose other operations, below I give no Apache operation rights to introduce a friend PHP custom 404 page Operation method.

Method One

The code is as follows Copy Code

@header ("http/1.1 404 Not Found");
@header ("status:404 not Found");
echo ' echo 404 ';
Exit ();

Loading a 404 error page

The code is as follows Copy Code


@header ("http/1.1 404 Not Found");
@header ("status:404 not Found");
Include (".. /.. /404.htm ");
Exit ();


You can also add the. htaccess code to the site below

The code is as follows Copy Code

ErrorDocument 404/404.html

If you have APAHCE configuration permissions, we can modify the httpd.conf

Found it:

The code is as follows Copy Code
#ErrorDocument "The server made a boo boo."
#ErrorDocument 404/missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 xxxxxxx


Revision changed to

The code is as follows Copy Code
ErrorDocument 404/404.htm

http://www.bkjia.com/PHPjc/628782.html www.bkjia.com true http://www.bkjia.com/PHPjc/628782.html techarticle 404 page is a tell the search engine this page does not exist, but also prompted the user can choose other operations, the following I will give no Apache operation rights to introduce a friend PHP custom ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.