search

Force HTTPS Redirect via .htaccess in WordPress

After installing an SSL certificate, add the following code to your .htaccess file to redirect all traffic from HTTP to HTTPS. For more on migrating your WordPress site to HTTPS.

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

Make sure the code is placed at the top of your .htaccess file, before the existing WordPress rules.

Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo