Utility 301 to the corresponding page of another domain name ASP code _ Application Tips

Source: Internet
Author: User
Tags servervariables
A few days ago, in order to enhance the site's SEO, set about another domain name: www.kanshule.com under the 301 turn to www.jb51.net under the page.
Since the site currently has only one blog, so from the beginning of the blog.
The idea is very simple, get the current browsing page of the domain name, if you need to turn to the domain name, and then replace the domain name part, as a new address to 301 turn.
The code is as follows:
Copy Code code as follows:

<%
Dim Todomain,fromdomain,curdomain,q,p,url
Todomain=www.jb51.net
Fromdomain= "Kanshule.com"
Curdomain=request.servervariables ("Http_host")

If InStr (Curdomain,fromdomain) >0 Then
Q=request.servervariables ("Query_string")
P=request.servervariables ("URL")
Url= "http://" &toDomain&p& "furl=kanshule.com"?
If q<> "" Then url=url& "&" &q

Response.status= "Moved Permanently"
Response.AddHeader "Location", url
Response.End ()
End If
%>

Deliberately added a parameter to the URL to record how many accesses are accessed from this domain name.
Save this file as an ASP file that contains any of the ASP pages you want to jump to.
Blog, there are calls to the common database connection file conn.asp, I will include this file in Conn.asp, fix.
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.