Custom 404 status error page for header in php

Source: Internet
Author: User
The 404 page tells the search engine that the page does not exist, and also prompts users to select other operations. next I will introduce php custom 404 to my friends who do not have apache operation permissions.

The 404 page tells the search engine that the page does not exist and also prompts you to select other operations, next, I will introduce my friends who do not have the apache operation permission to the operations on the custom 404 page in php.

The instance code is as follows:

  1. @ Header ("http/1.1 404 not found ");
  2. @ Header ("status: 404 not found ");
  3. Echo 'echo 404 ';
  4. Exit ();

Load a 404 error page

The instance code is as follows:

  1. @ Header ("http/1.1 404 not found ");
  2. @ Header ("status: 404 not found ");
  3. Include ("../404.htm ");
  4. Exit ();

You can also add. htaccess to the site. the instance code is as follows:

  1. Errordocument 404/404 .html

If you have the permission to configure apahce, you can modify httpd. conf and find:

The instance code is as follows:

  1. # ErrorDocument 500 "The server made a boo ."
  2. # ErrorDocument 404/missing.html
  3. # ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  4. # ErrorDocument 402 xxxxxxx

Change

The instance code is as follows:

  1. ErrorDocument 404/404 .htm

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.