Phpheader404 error: contains file garbled characters

Source: Internet
Author: User
Usually, when judging a non-existing resource (such as category or product does not exist) through php, you need to return a 404 status through the header and display the corresponding 404 page. the method on the previous server is as follows: header (#3... usually, when judging a non-existing resource (such as category or product does not exist) through php, you need to return a 404 status through the header and display the corresponding 404 page. the method on the previous server is as follows:

Header ('http/1.1 404 Not Found '); header ('status: 404 Not Found'); require ('404. php'); exit ();

However, after a new server is changed, it finds that some letters and numbers are garbled on the page. after checking, it is found that the communication protocol version is inconsistent with HTTP/1.1 in the code when the current server request page is displayed, to know the name and version of the communication PROTOCOL of the current server, use $ _ SERVER ['server _ protocol']. after testing, the http version of my SERVER is 1.0, so the code should be changed:

Header ('http/1.0 404 Not Found '); header ('status: 404 Not Found'); require ('error. php'); exit ();


Article URL:

Reprint ^ at will, but please attach the tutorial address.

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.