Since Google says https gives websites a small ranking benefit and Let's Encrypt gives free certs, more and more sites have been converted. This is a more thurral snippet of https redirection. It has some rules from Drupal's htaccess. This avoids all kind of redirection loops etc... Also redirect from www to non-www, which can be removed or turned into reverse.
Source code viewer
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On # Set "protossl" to "s" if we were accessed via https://. This is used later # if you enable "www." stripping or enforcement, in order to ensure that # you don't bounce between http and https. RewriteRule ^ - [E=protossl] RewriteCond %{HTTPS} on RewriteRule ^ - [E=protossl:s] # Make sure Authorization HTTP header is available to PHP # even when running as CGI or FastCGI. RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect all users to access the site WITHOUT the 'www.' prefix. RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301] # To redirect all users to access the site WITH the 'www.' prefix. # RewriteCond %{HTTP_HOST} . # RewriteCond %{HTTP_HOST} !^www\. [NC] # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteBase / # Redirect to HTTPS. RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPressProgramming Language: Apache configuration