It is said that the same website with multiple domain names will be considered to have duplicate content, which is not conducive to ranking in search engines. A better approach is to specify a main domain name and all other domain names will be redirected to this domain name. A few days ago, in order to enhance the SEO of this site, we started to 301 redirect all pages under another domain name: www.kanshule.com to www.vevb.com.
Since this site currently only has one blog, I started with the blog.
The idea is very simple. Get the domain name of the current page you are browsing. If it is a domain name that needs to be redirected, then replace the domain name part and use it as a new address to 301 redirect.
The code is as follows:
Copy the code code as follows:
<%
Dim toDomain,fromDomain,curDomain,q,p,url
toDomain=www.vevb.com
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 specially added to the url to record how many visits are from this domain name.
Save this file as an asp file and include it in any ASP page you want to jump to.
In the blog, the public database connection file conn.asp is called. I included this file in conn.asp and it was done.