Automatically redirect all http traffic to https with .htaccess (Apache) To automatically redirect all http traffic to https add the following code to your .htaccess file or apache config file RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]