Solved

redirect a http website to https.

Posted on 2013-11-07
10
469 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 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

Question has a verified solution.

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

Suggested Solutions

Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 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

13 Experts available now in Live!

Get 1:1 Help Now