Saturday, 8 September 2018

How to Redirect HTTP to HTTPS on Apache



Before setting up an Apache HTTP to HTTPS redirect for a site, make sure a SSL vhost already created and mod_rewrite module is loaded in Apache.

Create / edit file named .htaccess inside the website root directory of the apache:

[root@linuxcnf ~]# vi <apache-root-directory>.htaccess

Add the following file named .htaccess inside the website root directory of the apache:

RewriteEngine On
RewriteCond %{HTTPS} off

It’s done!

No comments:

Post a Comment