Please steer me towards a sample default file to put into the root directory

Discussion in 'General troubleshooting' started by wcswanson, Jan 30, 2015.

  1. Where can I find a complete sample of a default.hltml or default.aspx to put into the root directory to redirect url to proper folders?
    https://support.Winhost.com/kb/a649/how-to-redirect-a-subdomain-to-a-subdirectory.aspx gives the code but not the rest of the container. Is this sample code vb, vbscript or what?

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.HostingAccountDomain.com") ) > 0 Then
    Response.Redirect("/subdomain1")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.HostingAccountDomain.com") ) > 0 Then
    Response.Redirect("/subdomain2")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.HostingAccountDomain.com") ) > 0 Then
    Response.Redirect("/subdomain3/home.asp")
    End If
    %>
     
    Last edited by a moderator: Oct 14, 2015
  2. Elshadriel

    Elshadriel Winhost Staff

    It's kind of both, and it's complete. VbScript is just a subset of Vb. Just make sure you name the file with an extension of .asp or .aspx, not .htm/.html.
     
    Michael likes this.
  3. This works:
    Put this into a text editor modifying the sample code to meet your needs:

    <%@ Page Language="VB" %>
    <!DOCTYPE html>
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta charset="utf-8" />
    <%
    If InStr(UCase(Request.ServerVariables("SERVER_NAME")), UCase("wcswanson.net")) > 0 Then
    Response.Redirect("/dnn")
    ElseIf InStr(UCase(Request.ServerVariables("SERVER_NAME")), UCase("wcs-solutions.net")) > 0 Then
    Response.Redirect("/dnn")
    ElseIf InStr(UCase(Request.ServerVariables("SERVER_NAME")), UCase("mdicsc.org")) > 0 Then
    Response.Redirect("/dnn")
    End If
    %>
    </head>
    </html>

    Save as default.aspx
     

Share This Page