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
RewriteRule
(.*) https://%{website_name}%{REQUEST_URI}
|
It’s done!
No comments:
Post a Comment