Forcing http calls to pull up your SSL

Discussion in 'Site Programming, Development and Design' started by Ray, Mar 22, 2011.

  1. Ray

    Ray

    Here is a simple guidelines on how to force http calls to your domain name to go into https. This will ensure that the connection is protected by the SSL protocol and that the data transmitted is encrypted.

    1. Connect to the web server using IIS 7 Manager.
    2. Go to IIS 7 URL Rewrite module and choose “Blank” rule.
    3. Type in a name for the rule and type in the Patter text box (.*)
    4. Go to Conditions and click on Add. For the “Condition Input” type {HTTPS}
    5. In the Pattern text box type (.*)
    6. Choose “Redirect” for the Action type.
    7. In the “Redirect URL” text box input “https://{HTTP_HOST}/{R:1}
    8. Set the Redirect type to “Found (302). This will improve your SEO for redirection.


    [​IMG]
     

    Attached Files:

    Last edited by a moderator: Oct 14, 2015
  2. My Website is not redirecting properly after forcing https

    Hi

    I have followed the step to actually get this https call through http.

    After i loaded my website, the page kept redirecting and never got to the homepage.

    please what do i need to do.

    awaiting your reply.
     
  3. Ray

    Ray

    Sounds like your rule is incorrect and you may have some kind of eternal loop occurring. I cannot tell for sure until you give me a URL to test out.
     
  4. Should the condition be HTTP?

    I'm new to the URL Rewrite module, so I might be missing something, but it seems like the condition should be {HTTP}, not {HTTPS}. Doesn't the condition determine whether or not to do the rewrite? It seems like you would only want to rewrite the URL to use https if the origninal URL used http.
     
  5. After some research and experimentation I found that the pattern for step 5. of the original post should be: off
    {HTTPS} returns "on" when a request comes via https "off" when it does not.

    But, I have another problem I haven't solved. If I use the redirect URL:
    https://{HTTP_HOST}/{R:1}
    I always get redirected back to the root of my web site. Any subdirectories or files in the path are not appended by {R:1}. But, if I use:
    https://{HTTP_HOST}/{REQUEST_URI}
    everything works as expected.

    But, from everything I've read, https://{HTTP_HOST}/{R:1} should work. Does anyone have any ideas why it wouldn't?
     
  6. The steps in the first post did not work for me. This is what I used, and it works great:

    1. Connect to the web server using IIS 7 Manager.
    2. Go to IIS 7 URL Rewrite module and choose “Blank” rule.
    3. Type in a name for the rule and type in the Patter text box (.*)
    4. Go to Conditions and click on Add. For the “Condition Input” type {HTTPS}
    5. In the Pattern text box type (^OFF$)
    6. Choose “Redirect” for the Action type.
    7. In the “Redirect URL” text box input “https://{HTTP_HOST}/{R:1}
    8. Set the Redirect type to “See Other (303)
     

Share This Page