Redirect http to https

During your RHCE Training (if you had done the official RHCE training) you must have have learned how to secure your website using https and self signed certificate.

And then you can access the secure website by writing ““.

But in this you are not forcing the users to use the secure connection, they can still use the http protocol to access the website.

Now you want to force users to use https even if they are giving http in the address bar.

The solution is very simple and straight forward. Just write –

Redirect Permanent /var/www/html

in the /etc/httpd/conf/httpd.conf file

Obviously for this you must have generated the certificate for the website either by using self signed key or by using a Certificate Authority and then attaching the key and the certificate in the ssl.conf file. (I am not covering that in this tip).

So once you are done with all this just open the browser and type –

and you will automatically be redirected to https .. a secure connection.

Here is the screenshot from my httpd.conf file.

Redirect http to https

Redirect http to https