Redirect all HTTP traffic to HTTPS

There are lots of “plugins” and “applications” being sold to people these days which perform this step but they are not necessary. All you need is a small configuration edit. This works for both Apache and Nginx.


Place this inside your virtual-host configuration

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$$1 [R,L]


Here is a block of code that goes into your per-server configuration for Nginx

server {
        listen 80;
        rewrite ^ https://$server_name$request_uri? permanent;

That’s it! If you have any questions please send us an E-mail and we’ll be happy to help you!