can't redirect from root to subfolder

Discussion in 'General troubleshooting' started by rharik, May 7, 2011.

  1. Hi I have an mvc app in my root, I have a subdirectory called QA I have a subdomain called QA.Mydomain.com and in this subdirectory I have my qa copy of the site.
    In IIS7 I have gone to the default document section, I have removed all the items except Winhost_subdomain_redirector.htm which currently just has the text "hello world". There's no <head> section or anything just text. I never see this file. which of course means it's not getting hit. It's going straight to the root mvc app. obviously if it were to hit this default page I would then change it to say

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("qa.mydomain.com") ) > 0 Then
    Response.Redirect("/qainstance")

    %>

    which I would hope would redirect but first things first I gotta hit the default document.
    any help would be greatly appreciated
    thx
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    I'm a little confused what do you mean "first I gotta hit the default document"? What is your default document?
     
  3. so I am speaking of the "default document" referred to in the knowledge base article #649 which says " You will need to place it as default document on your document root. "
    As this is indeed rather cryptic I had to interpret that they wanted me to put a document in the root dir, and designate it in the iis default document section as the default document.
    so if this document is never read then it will never redirect. Right now it is not being read. if it was being read the screen would say "hello world" or whatever. But it does not. My goal, ultimately, is to have iis read that document and follow the code that is prescribed in the above mentioned article. However, it is not.
    R
     
  4. Ray

    Ray

    Do you have a URL we can look at?
     
  5. Hi,
    so I have a knowyourturf.com that points to the root. then I have knowyourturf.com/qainstance that points, obviously to qa ( root -> qainstance ). And I have a subdomain qa.knowyourturf.com that point to the root. All I want is for qa.knowyourturf.com to point to the root -> qainstance folder.
    thanks,
    Raif
     
  6. Ray

    Ray

    You do have forms authentication running. For something like this its best you try ASP.Net URL Rewrite. First you will need to connect to our web server using IIS 7 Manager.

    http://support.Winhost.com/KB/a628/using-the-microsoft-iis-70-manager.aspx


    Log into the server using IIS 7 Manager.
    Once you are logged in go to module labeled “URL Rewrite”.
    Click on ‘Add Rules…’, and choose ‘Blank rule’ from the Add rule(s) window
    Type a name for the rule.
    Make sure you choose ‘Matches the pattern’ in the Requested URL: drop down box and ‘Regular Expression’ in the Using: drop down box.
    In the Pattern text box type (.*)
    Click on the button ‘Add Conditions’ then under the drop down box labeled ‘Logical Grouping:’ choose ‘Match Any’ and click on the ‘Add’ button.
    Type {HTTP_POST} for Condition input.
    Type ^sub1.mydomain\.com$ in the ‘Pattern:’ text box. Note the carrot sign ‘^’, the forward slash ‘\’, and the dollar sign ‘$’, these are regular expression symbols that you will need to add. Type the pattern just as I lay out.
    When the conditions are defined, you will be back in the Edit Rule window; choose ‘Rewrite’ in the ‘Action Type:’ drop down box.
    In the ‘Rewrite URL:’ text box type \sub1\{R:1}
    Put a check mark next to ‘Append query string’.
    Click on the Apply. Your rule is now setup.

    Bear in mind that \sub1\ is the folder where you uploaded your website into.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page