Converting HTTP to HTTPS
1 min readOct 21, 2019
- 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
- Use certificate autority (CA) to sign the certificate so that browser/cliet does trust it. Must use this for production services
- 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.