Switching Between HTTP and HTTPS Automatically

Discussion in 'General troubleshooting' started by sisovin168, Mar 9, 2009.

  1. Bruce

    Bruce DiscountASP.NET Staff

  2. VBScript to redirect subdomain

    As your link: http://support.discountasp.net/KB/a369/how-to-redirect-a-subdomain-to-a-subdirectory.aspx

    in VBScript, I save file "subdomain.vbs", then I log-in via my ftp account with your company and copy my subdomain.vbs to paste into the rootdirectory. for example:

    in the subdomain.vbs, I wrote code as below

    <%
    If InStr( UCase(Request.ServerVariables("NS1.DISCOUNTASP.NET")), UCase("about.a1open.com") ) > 0 Then
    Response.Redirect("/a1about")
    %>

    But, I do not know what is your "server_name". Please help me with your kind support.

    Chieng Sisovin
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    Chieng,

    you do NOT replace "SERVER_NAME", it is name fo the server variable.

    BTW, you need to say the file as .asp extension rather than vbs.
     
  4. Coding script on the default document with the .aspx extension

    In the default page of default.aspx, I write vbscript to redirect my subdomain to subdirectory as follows:

    <script type="text/vbscript">
    Dim sname, sPath
    sname = Request.ServerVariables("SERVER_NAME")
    sname = ucase(sname)
    sPath = Request.ServerVariables("PATH_INFO")
    if InStr(sname,"about.a1open.com") <> 0 then
    response.redirect "/about" & sPath
    elseif InStr(sname,"admin.about.a1open.com") <> 0 then
    response.redirect "/a1about/administrator" & sPath
    elseif InStr(sname,"admin.amazon.a1open.com")<>0 then
    response.redirect "/a1amazon-shop/administrator" & sPath
    elseif InStr(sname,"contact.a1open.com")<>0 then
    response.redirect "/contact" & sPath
    else
    response.redirect "default.aspx"
    end if
    </script>
    But I don't see it work as I type URL like http://about.a1open.com/ then Enter its result is show up the default page, it does not show up the default of the about page.

    I think because my redirect suddomain to subdirectory that's why I cannot use my SSL Certicate. I want to know that what limitation I use on SSL. For example, I want my web client login to his personal account, but when they login I code to redirect their account as on simple URL http://login.a1open.com -> https://login.a1open.com/a1logon/


    Normally, I can use only https://a1open.com/a1administrator. Do I need to request your discountasp.net team to setup on other URL if I want such as my switch of URL http://login.a1open.com/a1logon -> https://login.a1open.com/a1logon/

    Thank you for your supports,
    Chieng Sisovin
     

Share This Page