Jason Parms

http to https

A brief guide to redirect website from HTTP to HTTPS using .htaccess or web.config file

Website security is an inevitable need for any business, as the user will experience safe environment over the website. Many sites run with both versions HTTP and HTTPS that could cause SSL warnings and entice hackers to breach the website. It is recommended to force SSL connection on your entire website and ensure that web users are browsing your site over HTTPS secure channel.

To redirect website from HTTP to HTTPS, you need to contain following code using .htaccess or web.config files which depends upon server you use.

Redirect HTTP to HTTPS using .htaccess

Linux & cPanel
You need to place below code in .htaccess file in the cPanel on your Linux based server. This code forces users to redirect to HTTPS connection.

RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*){REQUEST_URI} [L,R=301]

Redirect HTTP to HTTPS using web.config

Windows & Plesk
You should use following code using web.config in Plesk panel on your Windows based server to redirect web traffic on HTTPS secure website.

       <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
         <match url="(.*)" /> 
           <add input="{HTTPS}" pattern="off" ignoreCase="true" />
         <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />

Where To Buy an SSL Certificate?

If you wish to provide safe browsing experience for your online visitors and looking for best SSL certificate, then SSL2BUY can help you to choose right certificate for your website. SSL2BUY offers wide range of SSL certificates at an inexpensive price that matches your business needs. When SSL is enabled on your website, your website will have green padlock and HTTPS just before your website name.

Leave a Reply