301 page to php, 301 page
Create the 301. php page and reference the 301. php page in the program entry file index. php.
301. The php content is as follows for reference only:
<? Php
$ The_host = $ _ SERVER ['HTTP _ host']; // obtain the current domain name
$ The_url = isset ($ _ SERVER ['request _ URI '])? $ _ SERVER ['request _ URI ']: ''; // judge the part after the address
$ The_url = strtolower ($ the_url); // convert the English letters to lowercase letters.
If ($ the_url = "/index. php") // you can check whether the homepage is correct.
{
$ The_url = ""; // If the homepage is displayed, the value is null.
}
If ($ the_host! = 'Www .baidu.com ') // If the domain name is not a URL with www, perform the following 301 jump
{
Header ('HTTP/1.1 301 Moved Permanently '); // issue the 301 header
Header ('location: http://www.baidu.com '. $ the_url); // jump to the URL with www
}
?>