What is the difference between IIS 301 redirection and code 301 redirection?

Source: Internet
Author: User
Tags php tutorial

1. First, let's talk about how to redirect IIS 301:

Open "Internet information service", right-click the folder or file you want to jump to, and choose "properties" from the context menu, under the "directory" option, find "connect to resource is the content source", select "redirect to URL", enter the page to jump to in the text box below, select the "client will be directed to" check box "permanent redirection of resources" under ", and click" application ".

2. Use the code to perform 301 redirection:

1. 301 redirection in PHP:

<? Php Tutorial
Header ("HTTP/1.1 301 Moved Permanently ");
Header ("Location: http://www.mydomain.com ");

2. 301 redirection under ASP:

<% @ Language = VBScript %>
Response. Status = "301 Moved Permanently"
Response. AddHeader "Location", "http://www.mydomain.com"

3. Redirection of 301 in ASP. NET:

<Script runat = "server">
Private void Page_Load (object sender, System. EventArgs e)
Response. Status = "301 Moved Permanently ";
Response. AddHeader ("Location", "http://www.mydomain.com /");

301 redirection in ColdFusion:

<. Cfheader statuscode = "301" statustext = "Moved permanently">
<. Cfheader name = "Location" value = "http://www.mydomain.com/">

All of the above methods can be redirected to a.com and B .com. However, the problem occurs when the code cannot implement callback. If the domain name we want to redirect contains a large amount of content indexed by Baidu and has a certain ranking in the search engine tutorial, I suggest you use IIS 301 redirection, in this way, the weight of the website can be transmitted without causing traffic loss. Code can also be used to redirect new domain names to old ones without much traffic.

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.