PHP header 301/404 Jump to note the detailed _php tutorial

Source: Internet
Author: User
If your page appears 301 or 404 for the user experience is a very serious problem, so we do php header301 or 404 must be careful and careful, and I came to see.

301 Jump

The code is as follows Copy Code

Header (' http/1.1 301 Moved permanently ');
Header (' location:http://www.abc.com/aaa/');
Exit ();

Do not miss the header (' http/1.1 301 Moved permanently '); Or you can't return 301.

404 error page

The code is as follows Copy Code

Header ("http/1.1 404 Not Found");

If the above does not work, you can try the following:

The code is as follows Copy Code

Header ("status:404 not Found");

So in order to be foolproof, can be written in two sentences:

The code is as follows Copy Code

Header ("http/1.1 404 Not Found");
Header ("status:404 not Found");

Tips,

If we write the code we have to use webmaster tools to test the return status is not what we want oh.

http://www.bkjia.com/PHPjc/633119.html www.bkjia.com true http://www.bkjia.com/PHPjc/633119.html techarticle If your page appears 301 or 404 for the user experience is a very serious problem, so we do php header301 or 404 must be careful and careful, and I came to see. ...

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