Apache Server Implementation 301 redirect Detailed

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Hello everybody, I am the kiness of Hunan push. Many seoer novice because has just contacted the SEO profession, realizes 301 redirects the importance, but does not know how to operate. The author of the Apache server to achieve 301 redirect detailed steps to share to everyone. The following will also be shared PHP, ASP, asp.net, ColdFusion, etc. 301 Redirect method. First of all, the author or the popularization of what is 301?

301 Redirect (redirect) also called 301 for permanent transfer (permanently moved), to redirect various network requests to other locations, is the Web page to change the address of the best way to search engine friendly, as long as not temporarily move the situation, It is recommended to use 301来 as a referral. The next two cases of the 301 redirect method.

First, the WWW domain name redirection. This is a situation that most of our webmaster will face when they build a station. So how do you do that? The address with WWW will be redirected without WWW, see the following code:

<files ~ "^. (HTACCESS|HTPASSWD) $ >
Deny from all
</Files>
Rewriteengine on
Rewritecond%{http_host} ^ (admin5\.com) (: 80)? [NC]
Rewriterule ^ (. *) http://www.admin5.com/$1 [r=301,l]
Order Deny,allow

If it is to take the direction of the WWW to the situation without the WWW, the writing is similar to the above, do not say more. Copy the code above to Notepad and rename it to. htaccess, and upload it to the root directory of the Web site. If this name is not supported locally, you can upload the root directory and modify the file name first. Second, the Web page redirection. There are two different situations here.

1th, only a small number of pages require redirection, as follows:

<files ~ "^. (HTACCESS|HTPASSWD) $ >
Deny from all
</Files>
Redirect Permanent admin5.com/old.html www.admin5.com/new.html
Order Deny,allow

2nd, for example, the site's navigation of a column to change the path of the redirect method. The original path is/old/and the new path is/news/as follows:

<files ~ "^. (HTACCESS|HTPASSWD) $ >
Deny from all
</Files>
Redirect Permanent admin5.com/old/www.admin5.com/new/
Order Deny,allow

Similarly, written in Notepad, renamed to. htaccess, also uploaded to the site root directory. When the local can not change the name of the first type of method mentioned in the easy names.

This is the Apache server implementation of the 301 redirect method. Article writing is very simple, I believe that as long as there is demand in this area webmaster friends are able to understand, hope to everyone will help.

This article by Hunan push (original http://www.hntui.com/jingyan/28.html) webmaster kiness late-night original, A5 starting. Reproduced please indicate the source, such as not marked Baidu or will stop the collection of your station, thank you!

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.