PHP Definition 404 Page implementation Code _php tutorial

Source: Internet
Author: User
Core code:
Copy CodeThe code is as follows:
@header ("http/1.1 404 Not Found");
@header ("status:404 not Found");
echo ' echo 404 ';
Exit ();

If you need to load 404 of pages can be the following code, mainly note the file path
Copy CodeThe code is as follows:
@header ("http/1.1 404 Not Found");
@header ("status:404 not Found");
Include (".. /.. /404.htm ");
Exit ();

See if 404 settings are successful you can use Firefox's Firebug plugin to view

View methods

In the case of installing Firebug, use the Firefox browser to open the page to check the 404 status Code, click on the bug icon in the lower right corner, start the "Network" tab, turn on "network – all/html–headers"; If everything works, you can see that includes headers , and the response to the various page parameters.

404 page impact on the site

The impact on SEO is not big. But there is, better than nothing. If you have this permission, you'd better set up a 404 page. This thing is like a site map, not all sites have to be set, but sometimes there is a need to set up.
Consider whether you want to set up 404 pages, you should consider the user experience, rather than SEO.

Check out the Apache 404 definition.
Apache Set 404 error page The way to set up 404 error pages for Apache server is simple, just add the following to the. htaccess file:
ErrorDocument 404/notfound.php

http://www.bkjia.com/PHPjc/326285.html www.bkjia.com true http://www.bkjia.com/PHPjc/326285.html techarticle Core Code: Copy code code as follows: @header ("http/1.1 404 Not Found"), @header ("status:404 not Found"); Echo ' echo 404 '; exit (); If you need to load 4 04 page can be the following code, ...

  • 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.