You can redirect a subdomain to a subdirectory by using ASP or ASP.net code.
When the requests are redirected using an ASP file, the URL in browser for redirected domains will show the correct domain name and the directory name where the request is being redirected. You can also redirect the requests to a specific file.
For example : http://subdomain1.YourHostedDomainName.com redirect to http://subdomain1.YourHostedDomainName.com/subdomain1 The following is a sample script that you can use to redirect a subdomain. You will need to place it as default document on your document root.
http://subdomain2.YourHostedDomainName.com redirect to http://subdomain2.YourHostedDomainName.com/subdomain2
2 <%
3 If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then
4 Response.Redirect("/subdomain1")
5 ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.YourHostedDomainName.com") ) > 0 Then
6 Response.Redirect("/subdomain2")
7 ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.YourHostedDomainName.com") ) > 0 Then
8 Response.Redirect("/subdomain3/home.asp")
9 End If
10 %>
11
NOTE :
1. Replace subdomain#.YourHostedDomainName.com with your actual subdomain URL.
2. Replace /subdomain# with your actual subdirectory name
3. In the last redirection statement in the example, we show how to redirect to a specific file