Detailed 301 Redirect

Source: Internet
Author: User
Tags error handling header include domain domain name root directory linux
A lot of students can't figure out what 301 is. and the impact of 301 on search engines? How do you set up the final 301? So write this article. This article gives you a full understanding of 301 redirects, clear 301 redirects.

What is 301 turn?

301 Turn (or call 301 Redirect, 301 jump) is one of the status codes in the header information (header) in the HTTP data stream returned by the server when the user or search engine sends a browse request to the Web server, indicating that this page is permanently transferred to another address.

Other common status code also includes, 200 means all normal, 404 Web pages can not find, 302 temporary turn, and so on.

Why do you want to do Web site turn?

In addition to the Web site normalization issues described earlier, there are a lot of situations that need to be turned on. For example, to protect copyright, you have multiple domain names for different TLD:

Company.com
Company.net
company.org
company.com.cn
company.cn
Wait a minute.

Naturally these domain names all point to a website. If use company.com as the main domain name, other domain name can turn to company.com.

Or you registered the company name Longcompanyname.com, but too long, you also registered abbreviated domain name to facilitate the user to remember Lcn.com, one of the dominant domain name, the other can be turned to the main domain name.

Why do you turn with 301?

Web site steering methods mainly include: 301 turn, 302 turn, JavaScript turn, php/asp/cgi turn, meta-refresh web meta refresh, etc. The 302 steering may have URL normalization issues. Other methods are commonly used cheating, of course, not to say that can not be properly used, the method itself is not wrong, but the cheater used more, the search engine for these suspicious turn are very sensitive. Why take the risk?

When page A is redirected to page B with 301 redirects, the search engine can be sure that page a permanently changes location, or that it doesn't actually exist, and that the search engine will use page B as the only effective target. The advantage is, first, there is no website normalization problem, second, also very important, page A's PR page level will be uploaded to page b.

Many times other sites will link to

Http://domainname.com
Http://www.domainname.com/index.html
Http://domainname.com/index.html

And not what you want.

Http://www.domainname.com

This link to the PR will also be passed to all URLs, if you use 301 to turn the top three URLs to
Http://www.domainname.com
PR is also concentrated on the Web page http://www.domainname.com.

How to Judge Web site has the problem of normalization?

There is a word in English, do not repair if things are not bad. Many sites did not do 301 to the rankings also did not affect, then do not move it.

If you think the site rankings are not as good as expected, you can see if there is a URL normalization problem:

1 Check whether these URLs have the same PR value and a snapshot of the Web page:

Http://domainname.com
Http://www.domainname.com/index.html
Http://domainname.com/index.html
Http://www.domainname.com

If so, there may be a problem.

2 Search site:domain.com To see if there are multiple home page versions in the results.

3 Whether your site has a large number of pages in Google labeled as "supplemental material" (supplemental result). It is generally thought that being classified as "supplementary material" is a symptom of the problem of Web site normalization.

How to do 301 turn

If you are using a unix/linux host, you can use files (unix/linux for directory specific instructions such as passwords, steering, error handling, etc.).

For example, to transfer/old.htm to http://www.domain.com/new.htm, you can use this command:

REDIRECT 301/old.htm http://www.domain.com/new.htm

Or

REDIRECT Permanent/old.htm http://www.domain.com/new.htm

If you want to redirect all http://domain.com form URLs to http://www.domain.com with 301 redirects, include:

Http://domain.com/about.htm
Go to Http://www.domain.com/about.htm

And

Http://domain.com/dir/index.htm
Go to Http://www.domain.com/dir/index.htm

And so on, we need to use the mod_rewrite:

Options +followsymlinks
Rewriteengine on
Rewritecond%{http_host} ^domain.com [NC]
Rewriterule ^ (. *) $ http://www.domain.com/$1 [l,r=301]

If you are using a Windows host, you should make a 301 turn setting in the Control Panel.

Add: In the Web site normalization comments to answer the question of Stone King, may be helpful to everyone:

As far as I know, html can't do 301 turns. Only JS or meta REFRESH can be done in HTML, but not 301 turn. Once the HTML has been read, it has returned to the OK status code.

If your page is ASP or PHP can also do 301 turn:

Asp:

<%@ Language=vbscript%>
<%
Response.status= "Moved Permanently" Response.AddHeader "Location", "http://www.domain.com"
>

Php:

Header ("http/1.1 moved Permanently");
Header ("location:http://www.domain.com");
?>

In addition, the Dothtaccess file is just an ordinary text file, you use Notepad to build this file, put on the instructions, there is the root directory of your account will do. You do not need to modify Apache.

Ask:

Web page with 301 redirect after the search engine how long can handle

Web page with 301 redirect after the original search engine to include the old domain name of the page will be forwarded to the new domain name directed to. The search engine contains the old domain name of the page will change what happens, for example
Site:www.xxx.com after the old domain name will be transferred to the new domain name, how long.

For:

If your old web site uses HTTP 301 (permanent) redirection to point to your new site, the search engine will automatically be notified of the new URL when roaming and automatically update within 6-8 weeks.

301 redirect can promote search engine optimization effect

From the perspective of Search engine optimization, 301 redirect is the most feasible method of Web site redirection. When the site's domain name changes, the search engine will only index the new URL, but also the old address under the original external link to the new address, so that the site will not be ranked because of changes in the URL to receive the slightest impact. Similarly, when you use the 301 Permanent redirect command to point multiple domain names to the site's primary domain, there is no negative impact on the ranking of the site.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.