Home >Backend Development >PHP Tutorial >php implements 301 permanent redirect

php implements 301 permanent redirect

WBOY
WBOYOriginal
2016-07-25 08:45:141050browse

The following code implements 301 redirection. 301 redirection is a SEO search engine-friendly redirection method. Its purpose is to tell the search engine that the content currently being accessed has been transferred to other addresses.

The following is the code for php to implement 301 redirection:

  1. header("HTTP/1.1 301 Moved Permanently");
  2. header("Location: http://www.open-open.com/");
Copy code

Commonly used redirect methods are: 301 redirect, 302 redirect

301 redirect:: 301 stands for Permanently Moved. 301 redirect is the best way to be search engine friendly after the web page changes its address. As long as it is not a temporary move, it is recommended to use 301 for redirection.

302 redirect:: 302 represents Temporarily Moved. In the past few years, many Black Hat SEOs have widely used this technology to cheat. At present, all major search engines have stepped up their crackdowns, such as Google's punishment of business.com in previous years and its recent punishment of BMW's German website. Even if a website is not spam objectively, it can easily be misjudged as spam by search engines and punished.

redirect, php


Statement:
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