Redirect the traffic for www.mypenates.com to the subdirectory /mypenates

Discussion in 'DNS/Domain names' started by and900mor900, Mar 12, 2011.

  1. In the root directory /lawgarag there is a file:Winhostdefault.htm

    I want to redirect the traffic for www.mypenates.com to the subdirectory /mypenates.
    I have set up a sub domain pointer /mypenates.

    I have copied the code from the knowledge base http://support.Winhost.com/KB/a649/how-to-redirect-a-subdomain-to-a-subdirectory.aspx article into the Winhostdefault.htm file as below:

    HOWEVER THE TEXT between the <% .. %> is grey in VIsual Studio. This may be the main issue.

    <!DOCTYPE html>
    <html>
    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("www.mypenates.com") ) > 0 Then
    Response.Redirect("/mypenates")
    End If
    %>
    <head>
    <link rel="SHORTCUT ICON"
    href="Operations/images/LG/LG_AH_Icon%2016x16.psd"/>

    As per the instructions I have modified the
    1. Replace subdomain.HostingAccountDomain.com with your actual subdomain URL . : - www.mypenates.com
    2. Replace /subdomain with your actual subdirectory name. :- /mypenates
    However http://www.mypenates.com/ still displays the page for Law Garage in the root directory not the page at /mypenates

    Regards
    AND900MOR900
     
    Last edited by a moderator: Oct 14, 2015
  2. OK I have resolved this myself. You need a page with the aspx extension not htm extension
    Default.aspx
     
  3. Yes, the code was made for asp so it needs to be in a asp or aspx page.

    Glad to hear you got it working.

    I believe you brought up the IIS module called "URL rewrite" in a ticket, which is also another option to performing these types of redirects without having to write the code manually.

    Customers can access this module through IIS manager.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page