How To Redirect http to https in Apache

How To Redirect http to https in Apache

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]

Post Author: lensesview

Lensesview is founded on a simple premise: honest reviews for the Zambian electronic consumer. Guide to tech trends and cybersecurity.

Invitation to Zambians. Do you have a contribution to make for your Zambian audience? Kindly leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.