PHP website 404 error page wording

Source: Internet
Author: User
Tags php website
Each site is basically not less than 404 this page, 404 page is the role of the user to visit a nonexistent page in your site or inaccessible pages, this time through the 404 page to the current user a friendly and clear reply. Tell him the address doesn't exist, and tell him what to do next.

In the PHP program, we also often need to consider how to use PHP to implement page 404 jump, the following how the author will use PHP 404 to change the wording and share!

@header ("http/1.1 404 Not Found");

@header ("status:404 not Found");
echo ' echo 404 ';//output page error message directly
Exit (); or: @header ("http/1.1 404 Not Found");
@header ("status:404 not Found");
Include ("http://www.scutephp.com/404.html");
Jump to a page, it is recommended to use this method, note that the include file path cannot be a network path

Exit ();

To see if the 404 settings are successful, you can use the Firefox Firebug plugin to view the following: In the case of the installation of Firebug, use the Firefox browser to open the page to check the 404 status code, click the bug icon in the lower right corner, start the "Network" tab, Turn on "Network – all/html–headers"; If everything works, you can see the page parameters including headers and responses.

Also here is the definition of the Apache 404 error page, specifically defined as follows:


Create a new. htaccess file in the root directory of the Web site, and then add the following to the file:

ErrorDocument 404 http://www.scutephp.com/404.html
  • 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.