Explanation 301 permanent redirection Implementation Method

Source: Internet
Author: User
Tags website hosting

301 permanent redirection has no adverse effect on Seo, And the keyword ranking and PR level of Web Page A will be sent to web page B. If the website has changed its domain name, the website will be permanently transferred to another address, for Search Engine Optimization | Seo, it provides a friendly information for the search engine, telling it that the page has been permanently redirected, so that the search engine cannot find the page.

When to use 301 redirection

1: When a website domain name is changed, the old domain name will be redirected to the new domain name through 301 permanent redirection to save traffic loss and Seo.

2: When you need to delete some directories on the website, for example, if you want to delete the blog navigation under my blog, you can use 301 to permanently redirect to the homepage of the website.

3: If you have multiple idle domain names that need to direct to the same website, you can achieve this through 301 permanent redirection.

4: you are planning to standardize the URL. For example, if the URL is static, You can redirect dynamic URLs to static URLs.

How to standardize URLs

I will focus on the standardization of this website, because this is a problem that everyone can easily ignore. For example, if my domain name is not set, it will generate four URLs by default:
(1) www.maidq.com (2) maidq.com (3) www.maidq.com/index.html (4) maidq.com/index.html
If 301 redirection is not performed, the prvalue of your site's primary domain name will be distributed to several other URLs. First, query the prvalues of the above four websites. If the results are consistent, there is no standardization problem with the website. If the results are inconsistent, there is a standardization problem. At this time, we need to use 301 permanent targeting technology to standardize the website. It should be noted that, maidq.com and www.maidq.com, WWW is actually a second-level domain name. Generally, the domain name without WWW is a first-level domain name, and the weight will be higher, however, Internet users are used to entering websites with www. Therefore, we recommend that you redirect maidq.com 301 to www.maidq.com.

I know that there are two common 301 redirect settings. One is directly set through the IIS interface, and the other is to implement 301 redirect settings through code. We recommend that you use server components for redirection. In the following example, I will redirect my domain name fuduolai.com 301 to www.maidq.com for explanation.

1: IIS server implements 301 redirection

Open IIS, right-click Properties-website-Where to add a site, add a site, bind a Host Header, or bind multiple idle domain names. :

Start IIS, first create a new site, corresponding to a directory e: \ wwwroot \ 301web. This directory only requires two files, one
Default.html,404.htm. Right-click the webpage or directory to be redirected, select "redirect to URL", and enter the address of the target page in the dialog box. Remember to select
"Permanent redirection of resources"; of course, click "application" to complete. As shown in:

Directory redirection:

Webpage redirection:

2: Apache server implements 301 redirection

In Apache, there is a very important file. htaccess. Through setting it, You can implement many powerful functions. 301 redirection is only one of them. Find redirect permanent/http://www.fuduolai.com:
Redirect permanent/index.html http://www.maidq.com: modify this sentence.

3: add the 301 redirection command to the. htaccess file.

The "mod_rewrite" technology is used, for example:

Rewriteengine on

Rewriterule ^ (. *) $ http://www.maidq.com/#1 [R = 301, l]

4: Applicable to users who use Unix network servers

Use this command to notify the search engine spider that your site file is not under this address. This is a common method.

Shape: Redirect 301/http://www.maidq.com/

5: complete 301 redirection in the system administrator configuration area of the server software

Applicable to users who use Windows Network Servers

6: bind/local DNS

If you have the permission to edit and modify local DNS records, you only need to add a record to solve this problem. If you do not have this permission, you can ask the website hosting service provider to set the DNS server accordingly.

DNS server settings

To direct tuan.maidq.com to www.maidq.com, you only need to add an alias record in the DNS service and write it as Tuan in cname www.maidq.com.

If you need to configure a large number of virtual domain names, you can write them as * In cname www.maidq.com. to redirect all unset records ending with maidq.com to www.maidq.com.

7. Use ASP/PHP to implement 301 redirection:


Response. Status = "301 moved permanently"

Response. addheader "location", "http://www.maidq.com /"

Response. End


Header ("HTTP/1.1 301 moved permanently ");

Header ("Location: http://www.maidq.com /");

Exit ();


301 redirect code and test tools

Foreign: http://www.sEoconsultantS.com/tools/Headers

Country: http://www.rAnknow.cn/toOLS/redirectCheck

If result 200 is displayed, the request is successful, and the request's desired response header or data body will be returned with this response.

Common jump Methods

301 represents a permanent transfer. 301 redirection is the best method that is friendly to the search engine after the webpage changes the address. As long as it is not a temporary transfer, we recommend that you use 301 for the transfer.

302 indicates temporary transfer. This command can be used only when a website or webpage is temporarily moved to another location within 24 to 48 hours. Google is the only one with excellent processing capabilities for 302 redirection. In the past few years, many Seo companies have applied this technology extensively, but they are also prone to punishment.

Jump with HTML: <meta HTTP-EQUIV = Refresh content = "5; url = http://www.maidq.coM ">, indicates that the page will automatically jump to the homepage in 5 seconds. You can also set the time to a shorter value, but it is also easy for the search engine to misjudge it as spam and be punished.

Skip with javascript: <script language = "JavaScript"> location. href = 'HTTP: // www. maidq. coM' </scripT>

What is the difference between forwarding and redirection?

In other words, forwarding is a server action, and redirection is a client action. One request at the time of forwarding. The redirection is two requests. The forwarding address bar will not change, the redirection address bar will change, and the redirection will be forwarded within the project.
It can be transferred out of the project. When forwarding is used, the JSP Container uses an internal method to call the target page. The new page continues to process the same request, and the browser will not know the process.
In contrast, redirection means that the first page notifies the browser to send a new page request.

How to Choose redirection or forwarding?

Generally, forwarding is faster and objects in the request can be kept. Therefore, it is the first choice. However, after forwarding, the URL in the browser still points to the start page. If you reload the current page, the start page will be called again. If you do not want to see such a situation, select forwarding.

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.