How does ASP implement 301 redirect

Source: Internet
Author: User
Tags servervariables

The use of 301 redirect can be without the WWW domain name to the WWW domain name, so that the weight can be all pointed to the domain name with www, the site optimization is very helpful.

<% Dim server_name,path_infostr,query_stringstr path_infostr=lcase (Request. ServerVariables ("Path_info")) Server_name=lcase (request. ServerVariables ("SERVER_NAME")) query_stringstr=request. ServerVariables ("query_string") If query_stringstr<> "" Then query_stringstr= "?" &query_stringstr IF InStr (server_name, "www.") <1 Then response.status = "Moved Permanently" if InStr (Path_infostr, "index") >0 or InStr (PATH_INFOSTR, "default" ) >0 Then Response.AddHeader "Location", "

http://www. " &server_name Else Response.AddHeader "Location", "http://www." &server_name&path_infostr&query_stringstr End If Response.End End If%>

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.