Absrtact: What is 301 redirect, 301 turn, 301 jump. 301 is one of the HTTP status codes specified in the www. 301 redirects, 301 turns, 301 jumps are all meant to be when a user or search engine sends a browse request to a Web server, the server returns
What is 301 redirect, 301 turn, 301 jump. 301 is one of the HTTP status codes specified in the www. 301 Redirect, 301 turn, 301 jump is a meaning, when the user or search engine to the Web server to send a browse request, the server returned the status code, indicating that this page permanently transferred to another address. Other common status codes still have 404 Web pages found, 200 normal return, 302 temporary steering and so on. What's the use of making a 301 turn?
We know 301 redirects can permanently redirect a Web site to another site. 301 redirect is very important in search engine, 301 redirects can transfer the weight of the site. Specific role in the following areas: first, we can use 301 Redirect to the site migration, is to change the domain name, such as the original site's domain name is too long, not remember, the user experience is not good, we can switch to the new short good remember the domain name, with 301 redirect can realize the weight of the old station domain name transferred to the new station domain name above. Second, you can use the 301 redirect focus on the homepage of the weight, that is, URL standardization, the decentralized weight of all concentrated to the homepage, the weight of the site can get a good ranking, the specific set up methods can see I wrote this article: What is the URL standardization. Third, you can use 301 Redirect to achieve the site page, directory, domain name between the 301 redirect.
Because 301 redirect (301 turn, 301 jump) is to do SEO friends often need to use, basically every site is doing 301 Redirect, I am here to 301 redirect specific methods of operation to talk about.
First, use the. htaccess to implement 301 steering (This is the most commonly used 301 redirect setting method, suitable for apache+php+mysql environment)
Htaccess can implement 301 redirects between files, directories, and domain names, standardized URLs that are commonly used.
To bring the domain name without www to the WWW, set the code as follows:
Rewriteengine on
Rewritecond%{http_host} ^abc.com$ [NC]
Rewriterule ^ (. *) $ http://www.abc.com/$1 [l,r=301]
Take the WWW domain name out of the WWW, set the code as follows:
Rewriteengine on
Rewritecond%{http_host} ^www.abc.com$ [NC]
Rewriterule ^ (. *) $ http://abc.com/$1 [l,r=301]
Ii. using rewrite to realize 301 turn
Rewriteengine on
Rewriterule ^ (. *) $ http://www.abc.com/[r=301,l]
Three, with PHP code to achieve 301 redirect
This code is added to the top of the index.php file, with PHP 301 redirect can not achieve directory redirection
Four, with ASP code to achieve 301 redirect
Add the following code to the top of index.asp or default.asp: