(630) 492-0509 kyle@kyleeggleston.com

Switching your WordPress site from HTTP to HTTPS by installing an SSL certificate can seem daunting. Once you follow the instructions, it isn’t so bad. One frustration I encountered after installing many SSL certificates using WordPress was the 302 redirect it defaults to when forcing an HTTPS in .htaccess. I couldn’t find the right code until I stumbled upon the right trick.

Place this .htaccess code at the very top line of the file in order to force WordPress to 301 redirect to HTTPS:


RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]