How To Redirect http to https in Apache

Views: 250
Read Time:37 Seconds
Most users forget to type https and instead they type http. Its very normal in fact most do not even know they need to do that to remain secure when they are browsing.
Before you can set up an Apache redirect from http to https, you will need to do the following:
Make sure your SSL certificate is successfully installed so you can access https://www.yoursite.com (for more information see our Apache SSL Installation instructions)
Make sure mod_rewrite is enabled in Apache
Now you just need to edit your httpd.conf file or the file where your virtual host is specified and add these lines to redirect http to https:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]