Home > Backend Development > PHP Tutorial > PHP uses header function to implement 301 jump code example_PHP tutorial

PHP uses header function to implement 301 jump code example_PHP tutorial

WBOY
Release: 2016-07-13 10:25:07
Original
1063 people have browsed it

Small code for PHP 301 jump

Copy code The code is as follows:

$the_host = $_SERVER['HTTP_HOST'];
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
if($the_host !== 'www.jb51.net')
{
//echo $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www .jb51.net' . $_SERVER['PHP_SELF'] . $request_uri);
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825209.htmlTechArticleThe small code copy code for PHP 301 jump is as follows: ?php $the_host = $_SERVER['HTTP_HOST'] ; $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; if($the_h...
Related labels:
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