Redirect http to https in Apache

RussianRoot 23/11/2012 0

In this article I am going to show how you can redirect http to https in apache. Let’s say we have customer management software on http://customers.russianroot.net/ and you would like to use it securely to prevent data stealing, so you will have to redirect your user to https://customers.russianroot.net/.

So how to redirect http to https using httpd.conf or .htaccess in Apache?
First of all you will have to make sure that your Apache Webserver is configured for HTTPS connections and all necessary and correct SSL certificates are installed.

Redirect non-ssl to https

Open httpd.conf or .htaccess (Apache Module mod_rewrite is not required):
# nano httpd.conf

Add the following line :

Any request made to http://customers.russianroot.net will be forwareded to https://customers.russianroot.net/

Save and close your config file. Restart the Webserver (Not required for .htaccess):

This is one of X ways to ensure that your user will never use plain text HTTP protocol to send sensitive login data.

This makes it much harder to sniff private data.

Leave A Response »


8 × 3 =