?
Solved

redirect a http website to https.

Posted on 2013-11-07
10
Medium Priority
?
490 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 2000 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 18

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 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