RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Simply add the following code to a .htaccess file and all HTTP traffic will be redirected to HTTPS: