Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

redirect a http website to https.

Posted on 2013-11-07
10
Medium Priority
?
496 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
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 
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

Industry Leaders: 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

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.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

636 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