Solved

redirect a http website to https.

Posted on 2013-11-07
10
466 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
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
 
LVL 16

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Today I came across an interesting issue that had me pulling my hair out.  I was troubleshooting a new internal web site which uses integrated security instead of anonymous.  When browsing the site from my laptop, I was able to access it with no iss…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now