How to redirect a subdomain or make subdomain available using visual studio

Discussion in 'Domain names / DNS' started by MUSTAPHA, Jan 7, 2011.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. My question is where do i paste the code shown below in order to make subdomain available on net. is it the web configuration file or the new website configuration file.
    Another question is what is the default document on your document root.

    How to redirect a subdomain to a subdirectory
    For example:

    http://subdomain1.YourHostedDomainName.com --> http://subdomain1.YourHostedDomainName.com/subdomain1
    http://subdomain2.YourHostedDomainName.com --> http://subdomain2.YourHostedDomainName.com/subdomain2
    http://subdomain3.YourHostedDomainName.com --> http://subdomain3.YourHostedDomainName.com/subdomain3/home.asp

    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
    %>
     
  2. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Usually that would be default.aspx or default.asp (but you can define it in IIS).
     
  3. Example

    Please, i want u to give me example
     
  4. ...What technology would you like the example for?
    i.e. Classic ASP, ASP.NET, etc.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page