Converting HTTP to HTTPS

Deepak Pant
1 min readOct 21, 2019

--

  1. Not a good idea to run your website for both http and https version. Keep one up at a time

2. Can i use redirection for redirecting all the traffic to https ?

Hosting HTTP / HTTPS sites in your webserver

If you have to handle both the http and https connection in same host you have to do something like this in your .htaccess (webserver) file.

<VirtualHost *:80>
ServerName 'http://www.domain1.com'
DocumentRoot /var/www/your-domain-root
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/your-domain-root
ServerName 'https://www.domain1.com'
SSLEngine On
SSLOptions +StrictRequire
SSLCertificateFile /path/to/server.crt
SSLCertificateKeyFile /path/to/server.key
SSLProtocol TLSv1
</VirtualHost>

Read the following guide for the migration

How does HTTPS certificate verification works

First carefully watch the video

Next see how all of this works in browser.

Main points

  1. Use certificate autority (CA) to sign the certificate so that browser/cliet does trust it. Must use this for production services
  2. you can use self signed certificate for testing purposes and you don’t have to use (CA) for that. But don’t use this method when you are giving it to wider audience/user.

--

--

Deepak Pant
Deepak Pant

Written by Deepak Pant

Engineer, thinker and designer

No responses yet