Solved

redirect a http website to https.

Posted on 2013-11-07
10
479 Views
Last Modified: 2013-11-14
Hello,

we have a secured IIS7 site which "required SSL" is checked.  

We would like to configure it so that when users type http://server1 in the URL field, it redirects to https://server1.

Under the HTTP Redirect configuration, the "redirect requests to this destination" is checked and "https://server1" is also specified.  

Is this doable?

Please advise.

Thanks.
0
Comment
Question by:nav2567
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 4

Expert Comment

by:rajivkumar07
ID: 39630484
0
 
LVL 15

Accepted Solution

by:
pateljitu earned 500 total points
ID: 39630492
Please add this configuration to "web.config"

<system.webServer>
    <rewrite>
      <rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
</rules>
    </rewrite></system.webServer>

Open in new window

0
 

Author Comment

by:nav2567
ID: 39630695
I add what you advised to the web.config file but it does not work.  

Here is what we have in our current web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.webServer>
            <defaultDocument>
                  <files>
                        <add value="home.aspx" />
                  </files>
            </defaultDocument>
        <httpRedirect enabled="false" destination="https://server1.xyz.com" childOnly="true" />
      </system.webServer>
</configuration>
0
Don't miss ATEN at NAB Show April 24-27!

Visit ATEN at NAB Show to learn how our "Seamlessly Entertaining" solutions deliver fast, precise video streaming without delays for the broadcasting and media environment. ATEN will showcase its 16x16 Modular Matrix Switch (VM1600) and KVM Over IP Solution (KE6900 series).

 
LVL 17

Expert Comment

by:Emmanuel Adebayo
ID: 39630772
If you are running IIS7 you will need to install Rewrite module and then you can configure the rules.

See the following link on Rules configuration.

http://www.jppinto.com/2010/03/automatically-redirect-http-requests-to-https-on-iis7-using-url-rewrite-2-0/


regards
0
 

Author Comment

by:nav2567
ID: 39631370
Ok.  I have installed Rewrite.  I am still having trouble after created a new rule.  Can someone take a look at the attached screenshot and advise again?

Thanks.
redirect.bmp
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 39631465
Please see this setting, in Action section have provided with expression so that you do not need to specify explicit host name,

URL Rewrite
0
 

Author Comment

by:nav2567
ID: 39631665
Just tried and specify the exact.  It does not work ; (
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 39631917
#1. In IIS can you check "Bindings" and make sure SSL is configured properly.

#2. Can you please send web.config setting which you see for URL Rewrite.

Also try making this small change i.e. for pattern instead of "OFF" change that to "^OFF$"
<rewrite>
  <rules>
    <rule name="Redirect to HTTPS" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
    </rule>
  </rules>
</rewrite>

Open in new window



Article you can refer for IIS setting:

http://tech.mikeal.com/blog1.php/url-rewrite-for-iis7-http-to-https-redirection
0
 

Author Comment

by:nav2567
ID: 39636220
It works now.  But for some reason, behind the firewall works.  Outside of the company doesn't.  

Any idea?
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 39638806
Not sure on your network configuration, but can be that port 443 is blocked for external IP access.

For e.g. you can set a NAT rule on your ASA for 443 inbound connections.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
What You Need to Know when Searching for a Webhost Provider
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question