How to change the domain name to solve 301 problems

Source: Internet
Author: User
Keywords Solve domain name own

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

The replacement of the domain name for the webmaster is certainly very common, not we want to change, but 8630.html "> sometimes is really no way, recently registered a domain name, hard one months, encounter the PR update directly to 2, Baidu keyword ranking is also good, but Soso always not included, Submitted 100 times also no results, to submit the question to the Soso, the Customer Manager's reply is to give an address to send me to submit the URL. Alas, helpless, to do must do well, if Soso has been not included, although the mainstream volume from Baidu, but there is no harm to a source, the site only on line one months, a bite to change, then how to change the domain name to bring the least harm, of course, 301 redirect.

My site is a Web site where ASP generates static pages, have done before the first 301 redirect, is not to take the WWW to the above with the WWW, now to 301 is the original domain name with www, without the WWW and the new domain name is not with the WWW 301 to the domain name with www, the home page to the ASP suffix, Below the original code, here to AAA on behalf of the original domain name, BBB represents the new domain name, the following code:

<%

If Request.ServerVariables ("server_name") = "aaa.com" Then

Response.Status = "Moved Permanently"

Response.AddHeader "Location", "http://www.bbb.com"

ElseIf request.servervariables ("server_name") = "www.aaa.com" Then

Response.Status = "Moved Permanently"

Response.AddHeader "Location", "http://www.bbb.com"

ElseIf request.servervariables ("server_name") = "bbb.com" Then

Response.Status = "Moved Permanently"

Response.AddHeader "Location", "http://www.bbb.com"

End If

% >

The code may not be very concise, but the function is already implemented, placed on the top of the entire page, after putting the tool to detect whether 301, I have tested, is correct. The advantage of this is that the virtual space + service provider do not give you 301, we can not ask for their own solution, the disadvantages of course, is that the page can not be 301, if it is dynamic written in the Conn can also be achieved. Article original share, reprint please keep http://www.whmzt.com, thank A5 provide platform.

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.