How to Force Redirect HTTP to HTTPS in WordPress

This is the easiest way to redirect all HTTP URL’s to HTTPS.
Try this code. Just add it in .htaccess file at the root of your WordPress application.


   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php/$1 [L]
   RewriteCond %{HTTPS} off
   RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]