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 you to select other operations, next, I will introduce the operation methods for customizing the 404 page in php to my friends who do not have the apache operation permission.

Method 1

The Code is as follows: Copy code

@ Header ("http/1.1 404 not found ");
@ Header ("status: 404 not found ");
Echo 'echo 404 ';
Exit ();

Load 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 as follows:

The Code is as follows: Copy code

Errordocument 404/404 .html

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

Find:

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


Change

The Code is as follows: Copy code
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.