Home > Backend Development > PHP Tutorial > 301 page redirection to php, 301 page redirection_PHP tutorial

301 page redirection to php, 301 page redirection_PHP tutorial

WBOY
Release: 2016-07-13 09:46:19
Original
927 people have browsed it

The 301 page redirects to php, the 301 page redirects to

Create a new 301.php page, and reference the 301.php page in the program entry file index.php

The content of 301.php is as follows, for reference only:

$the_host = $_SERVER['HTTP_HOST'];//Get the current domain name
$the_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';//Judge the back part of the address
$the_url = strtolower($the_url);//Convert English letters to lowercase
if($the_url=="/index.php")//Judge whether Not the homepage
{
$the_url="";//If it is the homepage, the value is empty
}
if($the_host !== 'www.baidu.com')//If the domain name If it is not a URL with www, then perform the following 301 jump
{
header('HTTP/1.1 301 Moved Permanently');//Issue a 301 header
header('Location:http://www .baidu.com'.$the_url);//Jump to the URL with www
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1035424.htmlTechArticleThe 301 page is redirected to php, the 301 page is redirected to the new 301.php page, and 301 is referenced in the program entry file index.php. The content of php page 301.php is as follows, for reference only: ?php $the_host = $_SERVER['HTTP...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template