(Photo credit: Wikipedia) |
In Ubuntu 14.04, you need to enable the Apache rewrite module by running:
a2enmod rewriteNext you need to edit your website configuration file located in /etc/apache2/sites-available and add the following under DocumentRoot /var/www/yoursitedirectory:
<Directory /var/www/yoursitedirectory/>After that, save your configuration file and restart Apache by running:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</Directory>
service apache2 restartAfter that, not matter what page visitors land on they will be redirected to httpS!