Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Network | Monitoring » How to force your website to redirect from HTTP to HTTPS using a web.config file
  • telnet
    Could not open a connection to the host, on the port, connect failed Windows Server
  • screenshot 2020 03 13 at 20.24.17
    How to view installed packages in Cygwin Windows
  • Leave Slack
    How to remove a user from a Slack Channel JIRA|Confluence|Apps
  • Hadoop installation
    How to Install Hadoop on Linux Network | Monitoring
  • Blog inside@2x
    How to block automatic delivery of Microsoft Edge Chromium-based Windows
  • Password Migration to ICloud Keychain
    How to import your Chrome or Firefox passwords into your iCloud Keychain Mac
  • Capture 2
    MDT Invalid credentials: The network was not found Windows
  • MSDTworkaround
    Microsoft Support Diagnostic Tool Vulnerability Fix Windows

How to force your website to redirect from HTTP to HTTPS using a web.config file

Posted on 15/01/202220/03/2024 Temitope Odemo By Temitope Odemo No Comments on How to force your website to redirect from HTTP to HTTPS using a web.config file
HTTP redirect to HTTPS

In this guide I will be showing you what you can do if you don’t want your website to route to HTTP rather you want it to redirect from HTTP to HTTPS, put simply I will show yo how to force redirect your website visitor from HTTP to HTTPS. HTTP stand for Hypertext Transfer Protocol. You can read more related guides here: URL Rewrite: How to perform redirection from HTTP to HTTPS, and Disable HTTP access: How to disable web console in Cisco switches.

It is an application-layer protocol for transmitting data in the form of HTML or can be a set of rules for transferring files like text, sound, video, images and many more. It was originally designed for communication between different browsers but same can be used for other purposes.

HTTPS which stands for Hypertext Transfer Protocol Secure is an extension of HTTP. It is used for secure communication between one end of a browser to another end of a browser. It is a combination of HTTP with Secure Socket Layer (SSL) or Transport Layer Security. Both SSL and TLS are authentication and security protocols Implemented on browsers for secured communication.

Please see “IP Address UNREACHABLE: HTTP connection pool Max retries exceeded with url/wsman caused by NewConnectionError and How to Disable HTTP TRACE Method for Apache, IIS, sunOne, and Lotus Domino“.

Why you should protect your website

No one wants to provide or keep their confidential financial data on any improperly secured website. Like the below website that accepts credit card details and is not secure. So, what you need to do is buy an SSL Certificate and set it up.

Then make sure to force your website to redirect from HTTP to HTTPS. This ensures that the user is not on an unsecured page.

image 1
Unsecure Website

How to redirect form HTTP to HTTPS

Below is the web.config file that allows your website to direct to HTTP even if you have SSL Certificate installed.

web.config file - website to redirect from HTTP to HTTPS
HTTP web.config file

The above web.config file should be updated with the below web.config file in the http doc inside the file manager of your cPanel.

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name=”Redirect to https” stopProcessing=”true”>
                    <match url=”.*” />
                    <conditions>
                        <add input=”{HTTPS}” pattern=”off” ignoreCase=”true” />
                    </conditions>
                    <action type=”Redirect” url=”https://{HTTP_HOST}{REQUEST_URI}”    redirectType=”Permanent” appendQueryString=”false” />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
 
HTTPS web.config file

The below image shows the web.config file updated after you click on save.

web.config file - website to redirect from HTTP to HTTPS
web.config file updated

After the web.config file is updated it will start redirecting from HTTP to HTTPS (Secure) showing the padlock icon like the below image.

image 5
Unsecure website redirect to Secure website

I hope you found this blog post on How to force your website to redirect from HTTP to HTTPS using a web.config file very interesting and helpful.

In case you have any questions do not hesitate to ask in the comment section.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Network | Monitoring Tags:HTTPS, Windows 10

Post navigation

Previous Post: How to Resolve Microsoft RDP Connection Black Screen
Next Post: Desktop Wallpaper and Screen Saver Management: Configure and apply Group Policy Objects on Windows Server

Related Posts

  • cisco switches 2
    How to disable Spanning-Tree Globally Network | Monitoring
  • Synology Cloud Sync
    How to Sync Data in Cloud Drives to Synology NAS Backup
  • tmgexchange2013owachangepasswordform
    How to change your password in Outlook Web Access Network | Monitoring
  • images 1
    How to Monitor Windows Hosts via Nagios Network | Monitoring
  • Install Windows Admin Center on Windows Server 2019
    Configure Windows Admin Center on Windows Server 2019 Network | Monitoring
  • Exchange
    Update Global Address List: Recognition Error Network | Monitoring

More Related Articles

cisco switches 2 How to disable Spanning-Tree Globally Network | Monitoring
Synology Cloud Sync How to Sync Data in Cloud Drives to Synology NAS Backup
tmgexchange2013owachangepasswordform How to change your password in Outlook Web Access Network | Monitoring
images 1 How to Monitor Windows Hosts via Nagios Network | Monitoring
Install Windows Admin Center on Windows Server 2019 Configure Windows Admin Center on Windows Server 2019 Network | Monitoring
Exchange Update Global Address List: Recognition Error Network | Monitoring

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • telnet
    Could not open a connection to the host, on the port, connect failed Windows Server
  • screenshot 2020 03 13 at 20.24.17
    How to view installed packages in Cygwin Windows
  • Leave Slack
    How to remove a user from a Slack Channel JIRA|Confluence|Apps
  • Hadoop installation
    How to Install Hadoop on Linux Network | Monitoring
  • Blog inside@2x
    How to block automatic delivery of Microsoft Edge Chromium-based Windows
  • Password Migration to ICloud Keychain
    How to import your Chrome or Firefox passwords into your iCloud Keychain Mac
  • Capture 2
    MDT Invalid credentials: The network was not found Windows
  • MSDTworkaround
    Microsoft Support Diagnostic Tool Vulnerability Fix Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,839 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.