Redirect HTTP to HTTPS using mod_rewrite in Apache:-
1 – Enable mod_rewrite. Open terminal and type:
sudo a2enmod rewrite
2 – Edit your .htaccess file on the root of the directory you want to use SSL and add:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
If by any chance this doesn’t work, try to add these lines to your virtualhost configuration file.
3 – Restart apache
sudo service apache2 restart
1 – Enable mod_rewrite. Open terminal and type:
sudo a2enmod rewrite
2 – Edit your .htaccess file on the root of the directory you want to use SSL and add:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
If by any chance this doesn’t work, try to add these lines to your virtualhost configuration file.
3 – Restart apache
sudo service apache2 restart
No comments:
Post a Comment