| 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.
|
HTTP Error 502.5 - Process Failure error message when publishing an ASP.NET Core Website
Viewed 11434 times since Mon, Mar 27, 2017
How do I query MySQL Database in PHP ?
Viewed 3928 times since Tue, May 1, 2012
Do you allow custom COM components?
Viewed 3436 times since Tue, May 1, 2012
How do I send an email from my ASP.NET website by using SMTP Authentication?
Viewed 7107 times since Tue, May 1, 2012
How can I enable ASP.NET 3.5 on your Control Panel?
Viewed 4394 times since Wed, May 2, 2012
Do you support ASP.NET MVC 6?
Viewed 5472 times since Wed, Feb 17, 2016
How to solve the Let’s Encrypt SSL on ASP.NET Core
Viewed 10341 times since Mon, Jul 17, 2017
Issue with Storing Session
Viewed 4340 times since Tue, Mar 24, 2015
How to Deploy and host .Net Core 2 and Angular 6 app
Viewed 14077 times since Tue, Oct 23, 2018
Domain Name Server (DNS) Amplification Attack
Viewed 10047 times since Wed, Oct 15, 2014
|
