A5 Marketing: 301 redirect Complete resolution (for beginners)

Source: Internet
Author: User

Intermediary transaction SEO diagnosis Taobao guest Cloud host technology Hall

In the optimization of the site, 301 redirect is the webmaster must be an indispensable optimization, and 301 redirect is mainly used to move content from one location to another location. In fact, in understanding is also very simple, such as I have some content on the http://www.abc.com/a.html, and then I want to refactor the site, so I want to move the content on this page to http://www.abc.com/b.html. So I can implement a 301 redirect to transfer all of the metrics from this page to another page. One might ask, why do you have to do 301 redirects to the refactoring site? Before doing the 301 redirect, it is important to understand that redirection is important not only to the user, but also to search engines, when the site is revised and implemented with 301 redirects, You can let the user or search engine access to the old version of the page is not a 404 error page, but the successful access to the new version of the page, but also let the search engine to know when you moved the content, so the need to refactor the site to do 301 redirect.

  

Why do you talk about 301 redirects today? This is also because the A5 marketing team has found a wide variety of 301 redirect problems when analyzing and diagnosing corporate websites: for example, when the corporate web site is refactored, it does not redirect the old version of the page to the new version, resulting in a large number of 404 error pages in the reconstructed site, And the site because these 404 pages lead to weight loss, the right to drop. In addition, when you set 301 redirection, there is a setup error or you don't know how to set it. Therefore, A5 marketing team found that a lot of business owners of the 301 redirect awareness, operation errors. Then, A5 marketing to this problem to do some sorting, hope can help small and medium-sized enterprises webmaster correct, effective set 301 redirect.

The role of 301 redirect

301 The role of a lot of redirects, usually webmaster in doing 301 redirect, one is for the URL normalization and centralized weight not to let the weight of decentralized, the second is for the website revision, the old version of the page all the indicators transferred to the new version of the page. and implementation of 301 redirect can do these, in the role is also very strong, but also recommended small and medium-sized webmaster effective use of 301 Redirect to the site to bring the role.

Second, under what circumstances must do 301 redirect

The following five kinds of situations are required to do 301 Redirect, of course, if these five kinds of situation did not happen, you can choose not to do, the following A5 marketing detailed introduction.

①: The old content of the website expired and was deleted

Some of the content of the site expired, so to be deleted, if you want to stay can be achieved through 301 redirects.

②: Web site has some invalid URLs with links and traffic

If you find that these invalid URLs also have traffic weights, you can regenerate the page through 301 redirects.

③: Website replaced hosting company

If the site has been replaced by a hosting company, you do not need to do 301 redirects without affecting the user's search for any URL to the content of the site.

④: Website Replacement Program

Site for a larger revision, the Web site program needs to be replaced, this will affect many URLs, can be resolved through 301 redirects.

⑤: Website Implementation URL Normalization

Site default URL points:

1, ABC.com

2, www.abc.com

3, abc.com/index.html

4, www.abc.com/index.html

In order to make Web site normalization and do not scatter weights, usually only a standard URL, we can through 301 redirect to achieve. For example: my website Web site only appears http://www.abc.com/URL, I can redirect the other three URLs through 301 to this URL, so will not be scattered weight, May be with index.html suffix URL do 301 redirect prone to death cycle, in order to avoid such a situation is also a solution, the following A5 marketing will be explained in detail.

⑥: Web site changes the URL of existing content for a variety of reasons

May be the enterprise site for a variety of reasons to change the existing content URL, this situation is the webmaster can not predict, if this happened and changed the URL, recommended through 301 Redirect to solve, to avoid the emergence of dead links.

To summarize the above need to note: Not all cases need to do 301 redirect, but any URL changes are required to do 301 redirect. The reason is simple, in order to avoid the occurrence of 404 error pages, which should not happen.

Third, do 301 redirect Attention

When the 301 redirects are implemented, the old version of the page jumps to the new version of the page, or the URL is normalized or otherwise, most of the webmaster will not notice that 301 of the HTTP status is returned successfully. At this point, perhaps some of the Web site's 301 redirects do not pass the status or 404 error status Code, so easy to do in any case the 301 redirects do not achieve the effect. A5 Marketing believes that the right and effective to do 301 redirects, some details still need to pay attention to.

Example: 404 error (Page not found) or OK (page successfully loaded); 301 (return 301 status code successful)

Correct HTTP status code:

  

Bad HTTP status code:

  

To summarize the above need to note: If this situation is also a matter of importance, so to avoid such a problem occurs, if the webmaster in doing 301 permanent redirect, be sure to ensure that the HTTP status is returned 301, If the HTTP status code is not a return 301 status code but 200 or 404 or another status code, then 301 redirects should not be successful, it is recommended that the webmaster check which points out the problem and then solve.

Four, 301 permanent redirect weight will not stack

301 permanent redirect After the weight will not stack it? Many webmasters are considering this problem, some webmaster want to pass this way to opportunistic. A5 Marketing believes that the weight can be superimposed after 301 permanent redirects, but the weights do not add up. So, what kind of site do 301 redirect weights can be superimposed, what kind of site do 301 redirect weight can not be superimposed?

①: Two of the same site do 301 redirect can be superimposed weight, but the weight is not all transferred over, and to see the site character irregularities, in general, the weight of the transfer will be part of the loss.

②: Two different sites do 301 redirect is not to stack weights, why? If two sites are not the same, weight not only will not transfer over, and Baidu is not willing to do so, so two different sites can not pass weight and stacking weights.

The difference between five, 301 redirects and 302 redirects

There are a lot of ways to redirect, but different methods can have different results, and the difference is very large. Currently, according to the HTTP status code returned to the browser by the Web server, redirects are mainly divided into 301 permanent redirects, 302 temporary redirects, two redirects are based on different situations, the following A5 marketing detailed instructions for two redirects.

①:301 Permanent redirect

First, 301 permanent redirects. This status code tells the user, search engine, browser, the resource has been permanently moved to another location (the old version of the page permanently redirected to the new version of the page), and there is no intention to restore the original position. 301 permanent redirection is best for directory transfer, with 301 redirects recommended!

②:302 Temporary redirection

Then, 302 temporary redirection. This status code tells the user, search engine, browser that the resource has been temporarily moved to another location (the old version of the page is temporarily redirected to the new version of the page), this move is not as permanent, and will revert to the original location, but in some cases it is appropriate to use 302 redirection.

302 Redirect to mobile phone station optimization is a certain advantage, A5 marketing with the help of Baidu official advice: such as reducing the content of the dead chain, if there is no content, it is best to specify through the HTTP status code, such as 404, 403, etc. if the content dead chain want to redirect to the home page, preferably Do not use JavaScript jumps. At this point you can find that 302 redirect is good for cell phone station optimization.

Note: Both forms of redirection send users and search engines to new locations (pages), but the search engine treats these two HTTP status codes differently. When a search engine sees a 301 status code, it determines that the old version of the page will permanently transfer weights or any other metrics to the new page. When the search engine sees the 302HTTP status code, it assumes that it should not transfer the historical link and weight of the old page to the new page, meaning that it will be transferred back after the transfer. In addition, if you do 301 permanent Redirect, will cause the search engine from the index (Baidu, Google) delete the old pages and replace the new page.

Six, 301 Permanent redirect Home index file, how to avoid loops

Do the optimization of the webmaster should know, most of the site's home page URLs are in the form of http://www.abc.com/index.html, but are generally input http://www.admin5.cn/access to the home page. And at this time the first page appeared two version of the URL, the impact of the site is decentralized link weight. may have webmaster will think URL normalization. Yes, yes, a standard URL representation can be implemented through URL normalization.

Most webmasters see this through 301 permanent redirects that redirect http://www.abc.com/index.html to http://www.admin5.cn/, and then fix the URL through 301 permanent redirection. However, if the webmaster does not implement the 301 redirect correctly, the problem of 301 redirects usually expands, such as the phenomenon of dead loops.

Default Document Redirection Solution:

①: Copy index.php content to another file, such as a.php file.

②: Creates an Apache directoryindex directive for the document directory, sets the target of the quality to a.php, and does not set the directive at the server-wide level; otherwise, it may cause other problems that still require the use of index.php as a directory index.

③: In the. htdaccess file in the document root, add: DirectoryIndex a.php or, if you do not use a separate context file in each directory, you can put the following in. htdaccess: DirectoryIndex a.php

④: Clears the contents of the original index.php file and inserts the following code:

  

To summarize the above needs note: This setting makes index.php no longer a directory index file, or a default filename. It forces the read a.php when the user enters the specification urlhttp://www.abc.com/, then any request from the old link to the index.php is now 301 redirected and avoids an infinite loop.

Vii. How to implement 301 redirects

①: Virtual Host

Linux virtual Host Set 301 Jump method:

Create a new text file locally, preferably with professional editor software such as EditPlus to glue code into

Rewriteengine on

Rewritecond%{http_host}!^www.abc.com$ [NC]

Rewriterule ^ (. *) $ http://www.abc.com/$1 [r=301,l]

Description: The above rule is to redirect the site so that the domain name is redirected to www.abc.com (the domain name in the rule please modify to its own domain name), if only want to bind in a site domain name (such as: www.123.com) redirect to Www.abc.com, the rules are as follows:

Rewritecond%{http_host} ^www.123.com$ [NC]

Rewriterule ^ (. *) $ http://www.abc.com/$1 [r=301,l]

If there are multiple requirements, such as abc.com jump to www.abc.com qwe.com jump to www.qwe.com, the rules are as follows:

Rewriteengine on

Rewritecond%{http_host} ^abc.com$ [NC]

Rewriterule ^ (. *) $ http://www.abc.com/$1 [r=301,l]

Rewritecond%{http_host} ^qwe.com$ [NC]

Rewriterule ^ (. *) $ http://www.qwe.com/$1 [r=301,l]

According to their own needs to add changes, and then uploaded to the server wwwroot directory, renamed to. Htaccess can

Win virtual Host Set 301 Jump method:

Manually set (no automatic generation)

1, into the host Control Panel, into the ISAPI filter settings, click the "Open custom URL static support" button.

2, to open the pseudo static function, into the FTP file management, to find \others\discuz\httpd.conf modify this rule.

3. Sample code:

Rewritecond%{http:host} ^abc.com$

Rewriterule (. *) http://www.abc.com$1 [nc,r=301]

#第一条表示要做跳转的域名, the second one represents the domain name to jump to

#如果有很多域名要做跳转, the first rule can be changed to

Rewritecond%{http:host}!^www.abc.com$

This means that www.abc.com domain name access will jump to the www.abc.com #多个域名做跳转的第二种方法是, first copy multiple rewritecond items, change the domain name in addition to the last one, the remaining Rewritecond items must be added to the last parameter [ OR].

Note: Now many virtual hosts have their own 301 configuration, you can generate code information in the host Control Panel, and then follow the instructions above to carry out 301 redirects.

②:window Independent Services

Win Independent service 301 settings (Win2003, win2008):

1, IIS server implementation 301 redirect

Open IIS, right-properties-site IP address There dot edit add a site, then bind the host header, you can also bind more idle domain names. As shown in the figure:

  

Open IIS, first set up a new site, casually corresponding to a directory E:\wwwroot\301web. The directory requires only 2 files, one default.html, one 404.htm. Right-click on the page or directory you want to redirect, select Redirect to URL, enter the address of the destination page in the dialog box, and remember to select "Permanent redirection of resources" and, of course, click "Apply" to finish. As shown in the following illustration:

  

Note: Both Win2003 and win2008 use IIS servers, so the steps for 301 redirection are the same.

③:linux Standalone Server

Linux Standalone Server 301 settings (Red Hat Enterprise Edition, CentOS):

I use the Red Hat Enterprise Edition, with the source code packaging Web environment. Then I went into the Linux server, found Apache main configuration file httpd.conf, my Apache server has multiple virtual hosts, I found the virtual host I want to do 301 redirect, and then add how code (code is complete):

1, into the Linux server, and then find httpd.conf Apache main configuration file, the following figure red box is my full location, the blue box is the content, that is, command pwd reality location, LS query the current location of the content.

  

Now that we have found the main configuration file, we edit it through the command VI httpd.conf and add the following complete code at the end. To find the configuration of the virtual host and then add code, do not randomly add.

ServerName www.abc.com

ServerAdmin webmaster@dummy-host.example.com

LogLevel warn

ErrorLog Logs/dummy-host.example.com-error_log

Customlog Logs/dummy-host.example.com-access_log Common

ServerName abc.com

ServerAdmin webmaster@dummy-host.example.com

Rewriteengine on

Rewriterule ^ (. *) $ http://www.abc.com$1 [r=301,l]

LogLevel warn

ErrorLog Logs/dummy-host.example.com-error_log

Customlog Logs/dummy-host.example.com-access_log Common

Note: The different forms of Apache installed in its path is different, the source code package, there are yum installation methods, the two kinds of road is not the same, suggest novice contact space quotient and implement 301 redirect.

④: Binding/local DNS

If you have permission to edit the local DNS records, you can resolve the problem by simply adding a record. If you do not have this permission, you can require the Web site hosting service to set up the DNS server accordingly.

⑤:dns Server Settings

To point blog.abc.com to www.abc.com, you only need to add an alias record in the DNS service, which can be written as: blog in CNAME www.abc.com.

If you need to configure a large number of virtual domain names, you can write: * in CNAME www.abc.com.

This redirects all abc.com records that have not been set to the end of the www.abc.com.

Written at the end:

The above is the A5 marketing reorganization of the 301 redirect. Overall, the site can be revised through 301 redirect all the old version of the page to the new version of the page, the other is to do the normalization of the URL. The implementation of the process should pay attention to why to do 301 Redirect, method of operation, operation accuracy, etc., in order to better set 301 Redirect, A5 Marketing recommendations refer to the above collated content.

A5 Marketing Website SEO diagnostics (www.admin5.cn/seo/zhenduan/) services, for the right to reduce the site and optimize the site, to provide the most professional SEO advice, to help you create a (Baidu search and users like the site), to ensure that 100% increase the weight of the site, Invalid full refund. Customer service qq:800017899. Micro-letter: A5yingxiao Exchange Group: 134413448

Related Article

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.