Back to Blog
blogSEO
How to Force 301 WordPress Redirects when Switching from HTTP to HTTPS
Kyle Eggleston
Chicago SEO Consultant since 2004LinkedIn
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
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}


