404 page is a tell the search engine this page does not exist, but also prompted the user can choose other operations, below I give no Apache operation rights to introduce a friend PHP custom 404 page Operation method.
Method One
The
Header function in PHP is to send some header information before, if we can directly use it to do 301 jump, and so on, let me summarize the use of the header function and some common problems to solve the problem.
Sends an original HTTP header [HTTP
/**
* Send File
*
* @param string $fileName file name or path
* @param string $fancyName A custom file name, or null to use filename
* @param boolean $forceDownload whether to force download
* @param integer $speedLimit
Header information is very important. Two people, one is a server, and the other is a browser (client). There are two headers, request header information, and response header information.
If you use PHP to obtain the header information, the
Movie Station offers the movie BT download, due to the use of the Polaroid player, upload a movie when uploading a movie hash file. Using this hash file, the first time the request is dynamically generated, the corresponding BT seed is saved
**
Recently in self-study PHP encountered a little problem, beg all the way hero, thank you!
**The first case is normal, there is no content output in front of the header (), the picture can be displayed normally after downloading.
The second is the
//这里两句话很重要,第一讲话告诉浏览器返回的数据是xml格式 header("Content-Type: text/xml;charset=utf-8"); //告诉浏览器不要缓存数据 header("Cache-Control: no-cache");
These are my study materials, I understand that the head is to modify the META tag html, but the first set of
In PHP development, we often need to get the server information sent in the HTTP request, this article through a simple PHP example of the Get_headers function to obtain information about the server.
Get_headers () is a PHP system-level function
The cache of the Web page is controlled by the "Cache-control" in the HTTP message header, and the common values are private, No-cache, Max-age, must-revalidate, etc., and the default is private. Its function is divided into the following situations
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 '); otherwise, no 301 is returned.404 error page
Definition and usageThe header () function sends the original http header to the client.It is important to realize that the header () function must be called before any actual output is sent (in php 4 and later versions, you can use the output cache
Header ("Location:http://www.php.net");
?>
Copy Code forces users to get the latest information each time they access the page, rather than using a cache that exists on the client.
Tell the
Instructions for using the header () function:
I. role:~~~~~~~~~PHP only sends the HTML document header to the browser using the HTTP protocol to tell the browser how to handle the page. As for the transmitted content, you need to familiarize
Document directory
Header ('content-type: Application/image/pjpeg '); // output typeHeader ('content-Disposition: attachment; filename = "downloaded.jpg" '); // download the name displayed. Note the format.Readfile('my.jpg ');// Set the type
Syntax:
Send the original
Note:
Header
Parameter description:
Parameters
Description
String
Required. Specifies the header string to be sent.
Replace
Optional. Indicates whether the header replaces the previous
The Cache of web pages is controlled by "Cache-control" in the HTTP message header, common values include private, no-cache,-age, must-1-cache, must --- control:-age = 52---3-revalidate, and -- 4-control -: fri, 31 Dec 1999 16:00:00 = no-=-1-1.1 the
The header function sends some header information in php. If we can directly use it for 301 redirection, I will summarize the usage of the header function and some common solutions.
Send an original HTTP Header [Http Header] to the client. The
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.