A few days ago, in order to enhance the SEO of this site, I switched 301 of all pages under another domain name: www.kanshule.com to www.jb51.net.
Since this site currently only has one blog, you can start with it.
The idea is very simple. Get the Domain Name of the current browser page. If it is the domain name that needs to be switched, replace the domain name part and use it as the new address for 301 redirection.
Code As follows:
Copy code The Code is 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 = "301 moved permanently"
Response. addheader "location", URL
Response. End ()
End if
%>
A parameter is added to the URL to record how many accesses are accessed from this domain name.
Save the file as an ASP file, including any ASP page to jump.
In the blog, you can call the public database connection file conn. asp. I will include this file in conn. asp.