Website Domain name: www.***.com
Achieve the goal: input www.***.com or ***.com are able to enter the primary domain name www.***.com
System Category: ASP Class website
Prerequisites: The Site Administration panel can set the default home page
ASP Implementation Program
Example 1
| The code is as follows |
Copy Code |
|
<%
Website=request. ServerVariables ("SERVER_NAME")
' Get the domain name of the current access
If website= "icoa.cn" Then
' Judge if your domain name is icoa.cn
Response.status= "Moved Permanently"
Response.AddHeader "Location", "http://www.icoa.cn/"
' Do 301 Redirect to www.icoa.cn
End If
%> |
Example 2
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
| The code is as follows |
Copy Code |
|
<%
Response.status= "Moved Permanently"
Response.AddHeader "Location", "http://www.aaa.com/index.html"
Response.End
%> |
If you have your own server, we can use IIS to achieve 301 redirect, first of all, a new site under IIS, Old Bar binding (http://lao8.org)
, specify the directory where the Web site is located, and then check "redirect to URL" in the home directory to fill in the URL that you want to jump, and check "permanent Redirection of resources"
1, in your IIS home directory-> redirect url-> Enter the URL to be directed to (such as: http://www.111cn.net/)
2, then the following permanent orientation of resources to select, as shown in the following figure.