SlideShare a Scribd company logo
1 of 7
Download to read offline
IIS7 Redirect HTTP to HTTPS
Compare SSL Certificates
Redirecting all traffic from HTTP to HTTPS in IIS7 will make sure your users always access the site securely. There are
many different ways to set up an IIS7 Redirect from HTTP to HTTPS and some are better than others. The ideal HTTP to
HTTPS redirect would do the following:

    •     Gently redirect users to HTTPS so users don’t have to type in “https” in the URL
    •     Redirect users to the specific page that they were going to go to on HTTP (page.htm)
    •     Save any variables passed in the query string (?page=2)
    •     Work in all browsers
    •     Transfer PageRank to the redirected page by using a 301 redirect, maintaining SEO
    •     Allow specific parts of a site to force SSL but allow HTTP on other parts of the site
    •     Redirect users from mydomain.com to www.mydomain.com
Unfortunately, there isn’t an easy way to satisfy all of these requirements, and most methods only satisfy a few of them.
The best method of doing an HTTP to HTTPS redirect I’ve seen involves using ASP.Net to do the HTTP to HTTPS
redirection.
But most people don’t need all of those features, so I have listed two of the best methods of redirecting HTTP to HTTPS
in IIS 7. They are easy to set up and effective in most situations.

Method 1 – Using Microsoft URL Rewrite Module
For this method of redirecting from HTTP to HTTPS, you will need to do the following;

    1. Install the Microsoft URL Rewrite Module

    2. Install your SSL certificate in IIS 7 and bind it to your website

    3. Make sure Require SSL is NOT checked under SSL Settings for your website (uncheck the boxes that are checked
       in this screenshot)




    4. Copy and paste the following code between the <rules> and </rules> tags in your web.config file in your website
       root directory.
<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>




    5. Test the site by going to http://www.yoursite.com and making sure it redirects

Method 2 – Setting up a Custom Error Page
The second method of setting up an IIS7 redirect HTTP to HTTPS is to Require SSL on the site or part of the site and set
up a custom 403.4 error page. To do this, just following these steps:

    1. Install your SSL certificate in IIS 7 and bind it to your website
    2. In IIS, click on the site name, and go to the SSL Settings section




    3. Check Require SSL and Require 128-bit SSL and click Apply
4. After doing this, users will normally receive this error:
5. Create a new text file and paste the following into it:

    <html>
    <head><title>Redirecting...</title></head>
    <script language="JavaScript">
    function redirectHttpToHttps()
    {
        var httpURL= window.location.hostname + window.location.pathname +
    window.location.search;
        var httpsURL= "https://" + httpURL;
        window.location = httpsURL;
    }
    redirectHttpToHttps();
    </script>
    <body>
    </body>
    </html>




6. Save the file as redirectToHttps.htm in your C:Inetpub directory
7. Back in IIS, click on the site name and double-click the Error Pages option




8. Click Add… and enter 403.4 as the Status code. Browse for the redirectToHttps.htm file you just created and
   click OK
9. Select the error code and press Edit Feature Settings…
10. Click the Custom error pages option and again browse for the redirectToHttps.htm file




   11. Test the site by going to http://www.yoursite.com and making sure it redirects

A caveat of using a custom error page to do an IIS7 redirect from HTTP to HTTPS is that the web browser must have
JavaScript enabled for the redirection to work.

    For more details about Cheap SSL Certificates, visit; https://www.rapidsslonline.com/

More Related Content

Viewers also liked

Varam jevgenija butnicka
Varam jevgenija butnickaVaram jevgenija butnicka
Varam jevgenija butnicka
Egils Doroško
 
Doi thoai voi_nguoi_do_dau_tinh_than
Doi thoai voi_nguoi_do_dau_tinh_thanDoi thoai voi_nguoi_do_dau_tinh_than
Doi thoai voi_nguoi_do_dau_tinh_than
Sự Kiện Hay
 

Viewers also liked (14)

Менять мир - модно - Ольга Иванова
Менять мир - модно - Ольга ИвановаМенять мир - модно - Ольга Иванова
Менять мир - модно - Ольга Иванова
 
Mito.Myth.
Mito.Myth.Mito.Myth.
Mito.Myth.
 
Varam jevgenija butnicka
Varam jevgenija butnickaVaram jevgenija butnicka
Varam jevgenija butnicka
 
Ищешь вдохновение? Просто выйди на улицу
Ищешь вдохновение? Просто выйди на улицуИщешь вдохновение? Просто выйди на улицу
Ищешь вдохновение? Просто выйди на улицу
 
12702889
1270288912702889
12702889
 
Social media-strategy-pmi-abbigliamento
Social media-strategy-pmi-abbigliamentoSocial media-strategy-pmi-abbigliamento
Social media-strategy-pmi-abbigliamento
 
Jaqueline Leal - Portfolio 2013
Jaqueline Leal - Portfolio 2013Jaqueline Leal - Portfolio 2013
Jaqueline Leal - Portfolio 2013
 
Feeding the 5000-2
Feeding the 5000-2Feeding the 5000-2
Feeding the 5000-2
 
Korona express hofzug in Bulgarien
Korona express hofzug in BulgarienKorona express hofzug in Bulgarien
Korona express hofzug in Bulgarien
 
Doi thoai voi_nguoi_do_dau_tinh_than
Doi thoai voi_nguoi_do_dau_tinh_thanDoi thoai voi_nguoi_do_dau_tinh_than
Doi thoai voi_nguoi_do_dau_tinh_than
 
Copiii orbi
Copiii orbiCopiii orbi
Copiii orbi
 
Ensaio Docol
Ensaio DocolEnsaio Docol
Ensaio Docol
 
Ohaguro Tradition
Ohaguro TraditionOhaguro Tradition
Ohaguro Tradition
 
High Performance Computing
High Performance ComputingHigh Performance Computing
High Performance Computing
 

More from RapidSSLOnline.com

More from RapidSSLOnline.com (20)

Tackle ERR_SSL_PROTOCOL_ERROR in Google Chrome
Tackle ERR_SSL_PROTOCOL_ERROR in Google ChromeTackle ERR_SSL_PROTOCOL_ERROR in Google Chrome
Tackle ERR_SSL_PROTOCOL_ERROR in Google Chrome
 
Viewing SSL Certificate in Chrome | RapidSSLonline
Viewing SSL Certificate in Chrome | RapidSSLonlineViewing SSL Certificate in Chrome | RapidSSLonline
Viewing SSL Certificate in Chrome | RapidSSLonline
 
Compare GeoTrust True BusinessID SSL Data Sheet
Compare GeoTrust True BusinessID SSL Data SheetCompare GeoTrust True BusinessID SSL Data Sheet
Compare GeoTrust True BusinessID SSL Data Sheet
 
Introducing TLS 1.3 – The future of Encryption
Introducing TLS 1.3 – The future of EncryptionIntroducing TLS 1.3 – The future of Encryption
Introducing TLS 1.3 – The future of Encryption
 
GUIDE ON INSTALLING SSL CERTIFICATE ON IBM HTTP SERVER
GUIDE ON INSTALLING SSL CERTIFICATE ON IBM HTTP SERVERGUIDE ON INSTALLING SSL CERTIFICATE ON IBM HTTP SERVER
GUIDE ON INSTALLING SSL CERTIFICATE ON IBM HTTP SERVER
 
Cybersecurity Compliance can Make or Break Your Business - DigiCert - Symantec
Cybersecurity Compliance can Make or Break Your Business - DigiCert - SymantecCybersecurity Compliance can Make or Break Your Business - DigiCert - Symantec
Cybersecurity Compliance can Make or Break Your Business - DigiCert - Symantec
 
Adobe Connect on-premise SSL Guide
Adobe Connect on-premise SSL GuideAdobe Connect on-premise SSL Guide
Adobe Connect on-premise SSL Guide
 
How to Move SSL Certificate from Windows Server to Another Windows Server
How to Move SSL Certificate from Windows Server to Another Windows ServerHow to Move SSL Certificate from Windows Server to Another Windows Server
How to Move SSL Certificate from Windows Server to Another Windows Server
 
Symmetric and Asymmetric Encryption
Symmetric and Asymmetric EncryptionSymmetric and Asymmetric Encryption
Symmetric and Asymmetric Encryption
 
SSL / TLS Validation | CASecurity.org | RapidSSLonline
SSL / TLS Validation | CASecurity.org | RapidSSLonlineSSL / TLS Validation | CASecurity.org | RapidSSLonline
SSL / TLS Validation | CASecurity.org | RapidSSLonline
 
Geek Guide: Apache Web Servers and SSL Authentication
Geek Guide: Apache Web Servers and SSL AuthenticationGeek Guide: Apache Web Servers and SSL Authentication
Geek Guide: Apache Web Servers and SSL Authentication
 
All About SSL/TLS
All About SSL/TLSAll About SSL/TLS
All About SSL/TLS
 
A Complete RapidSSL Guide on Securing Online Business with SSL Certificate
A Complete RapidSSL Guide on Securing Online Business with SSL CertificateA Complete RapidSSL Guide on Securing Online Business with SSL Certificate
A Complete RapidSSL Guide on Securing Online Business with SSL Certificate
 
Google Chrome 56 What You Need to Know?
Google Chrome 56   What You Need to Know?Google Chrome 56   What You Need to Know?
Google Chrome 56 What You Need to Know?
 
The Hidden Costs of SelfSigned SSL Certificates
The Hidden Costs of SelfSigned SSL Certificates The Hidden Costs of SelfSigned SSL Certificates
The Hidden Costs of SelfSigned SSL Certificates
 
5 Steps for Preventing Ransomware
5 Steps for Preventing Ransomware5 Steps for Preventing Ransomware
5 Steps for Preventing Ransomware
 
2016 Symantec Internet Security Threat Report
2016 Symantec Internet Security Threat Report2016 Symantec Internet Security Threat Report
2016 Symantec Internet Security Threat Report
 
How Does The Wildcard SSL Work?
How Does The Wildcard SSL Work?How Does The Wildcard SSL Work?
How Does The Wildcard SSL Work?
 
Uncover threats and protect your organization
Uncover threats and protect your organizationUncover threats and protect your organization
Uncover threats and protect your organization
 
A New Zero-Day Vulnerability Discovered Every Week in 2015
A New Zero-Day Vulnerability Discovered Every Week in 2015A New Zero-Day Vulnerability Discovered Every Week in 2015
A New Zero-Day Vulnerability Discovered Every Week in 2015
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Learn about IIS7 redirection http to https from Platinum CA RapidSSLonline

  • 1. IIS7 Redirect HTTP to HTTPS Compare SSL Certificates Redirecting all traffic from HTTP to HTTPS in IIS7 will make sure your users always access the site securely. There are many different ways to set up an IIS7 Redirect from HTTP to HTTPS and some are better than others. The ideal HTTP to HTTPS redirect would do the following: • Gently redirect users to HTTPS so users don’t have to type in “https” in the URL • Redirect users to the specific page that they were going to go to on HTTP (page.htm) • Save any variables passed in the query string (?page=2) • Work in all browsers • Transfer PageRank to the redirected page by using a 301 redirect, maintaining SEO • Allow specific parts of a site to force SSL but allow HTTP on other parts of the site • Redirect users from mydomain.com to www.mydomain.com Unfortunately, there isn’t an easy way to satisfy all of these requirements, and most methods only satisfy a few of them. The best method of doing an HTTP to HTTPS redirect I’ve seen involves using ASP.Net to do the HTTP to HTTPS redirection. But most people don’t need all of those features, so I have listed two of the best methods of redirecting HTTP to HTTPS in IIS 7. They are easy to set up and effective in most situations. Method 1 – Using Microsoft URL Rewrite Module For this method of redirecting from HTTP to HTTPS, you will need to do the following; 1. Install the Microsoft URL Rewrite Module 2. Install your SSL certificate in IIS 7 and bind it to your website 3. Make sure Require SSL is NOT checked under SSL Settings for your website (uncheck the boxes that are checked in this screenshot) 4. Copy and paste the following code between the <rules> and </rules> tags in your web.config file in your website root directory.
  • 2. <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> 5. Test the site by going to http://www.yoursite.com and making sure it redirects Method 2 – Setting up a Custom Error Page The second method of setting up an IIS7 redirect HTTP to HTTPS is to Require SSL on the site or part of the site and set up a custom 403.4 error page. To do this, just following these steps: 1. Install your SSL certificate in IIS 7 and bind it to your website 2. In IIS, click on the site name, and go to the SSL Settings section 3. Check Require SSL and Require 128-bit SSL and click Apply
  • 3. 4. After doing this, users will normally receive this error:
  • 4. 5. Create a new text file and paste the following into it: <html> <head><title>Redirecting...</title></head> <script language="JavaScript"> function redirectHttpToHttps() { var httpURL= window.location.hostname + window.location.pathname + window.location.search; var httpsURL= "https://" + httpURL; window.location = httpsURL; } redirectHttpToHttps(); </script> <body> </body> </html> 6. Save the file as redirectToHttps.htm in your C:Inetpub directory
  • 5. 7. Back in IIS, click on the site name and double-click the Error Pages option 8. Click Add… and enter 403.4 as the Status code. Browse for the redirectToHttps.htm file you just created and click OK
  • 6. 9. Select the error code and press Edit Feature Settings…
  • 7. 10. Click the Custom error pages option and again browse for the redirectToHttps.htm file 11. Test the site by going to http://www.yoursite.com and making sure it redirects A caveat of using a custom error page to do an IIS7 redirect from HTTP to HTTPS is that the web browser must have JavaScript enabled for the redirection to work. For more details about Cheap SSL Certificates, visit; https://www.rapidsslonline.com/