Home » Categories » Multiple Categories |
How do I redirect a subdomain to a subdirectory? |
Article Number: 85 | Rating: Unrated | Last Updated: Tue, May 1, 2012 at 11:17 PM
|
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
http://subdomain2.YourHostedDomainName.com redirect to http://subdomain2.YourHostedDomainName.com/subdomain2
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.
<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain1")
ElseIf
InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.YourHostedDomainName.com") ) > 0 Then Response.Redirect("/subdomain2")
ElseIf
InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain3/home.asp")
End If
%>
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
|
Attachments
![]()
There are no attachments for this article.
|
My site is showing 500 Internal Server error message. What is wrong here?
Viewed 3037 times since Thu, May 3, 2012
I receive this error message: "Directory Listing Denied. This Virtual Directory does not allow contents to be listed."
Viewed 10017 times since Mon, Apr 30, 2012
How to solve ReportViewer error message: "An error has occurred during report processing. Input string was not in a correct format"
Viewed 7588 times since Tue, Jun 18, 2013
Why do I suddenly receive the error message: "Compiler Error Message: The compiler failed with error code XXXXXXXXX"?
Viewed 10727 times since Wed, Feb 17, 2016
How can I enable ASP.NET 3.5 on your Control Panel?
Viewed 3346 times since Wed, May 2, 2012
About Azure Key Vault
Viewed 951 times since Mon, Nov 2, 2020
I get an error Server.CreateObject Failed when I try to use CDONTs. What can I do?
Viewed 2391 times since Tue, May 1, 2012
How do I query MySQL database in ASP.NET?
Viewed 12007 times since Tue, May 1, 2012
Sample Code to Send email using ASP.NET 2
Viewed 6070 times since Tue, May 1, 2012
I cannot find a way to enable ASP.NET 4.5 on my Control Panel
Viewed 10458 times since Tue, Sep 11, 2012
|