How To Force SSL With Apache

On the Internet, all traffic in the 21st century shall be encrypted. That’s easy to do with Apache. Follow these instructions to force all traffic to the SSL pipe.

Rewrite Engine On
RewriteCond %{HTTPS} Off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Now any request that isn’t on https is redirected to https. This solution is port, host, uri agnostic.

Share Button