Thanks to letsencrypt.org I have installed ssl certificate on most of my sites. However after installing the certificate we also need to ensure that the traffic coming to http is redirected to https.
Use the following code in your vhost.conf file or where your apache configuration for the site is stored.
- RewriteEngine on
- RewriteCond %{SERVER_NAME} =staging.ravisagar.in [OR]
- RewriteCond %{SERVER_NAME} =www.staging.ravisagar.in
- RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]