Issue
As per instructions detailed in the document Redirecting all HTTP traffic to HTTPS, you have implemented the snippet:
RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
But the redirect is not occurring at all.
Resolution
The .htaccess file that is used is the one that comes standard as part of the Drupal 8 installation.
Ensure that the snippet is placed under the section that determines if the Apache mod_rewrite module is enabled. The section starts with "<IfModule mod_rewrite.c>"
Ensure that you don't put the snippet too far down in the section otherwise it will be overlooked by other .htaccess rules and the redirect will not occur.
Looking at the standard Drupal 8 version of .htaccess, the rewrite rule can be placed after the following snippet:
# Various rewrite rules. <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}] ...... [snip] ...... # If you do not have mod_rewrite installed, you should remove these # directories from your webroot or otherwise protect them from being # downloaded. RewriteRule "/\.|^\.(?!well-known/)" - [F] ...... [snip] ...... # # To redirect all users to access the site WITHOUT the 'www.' prefix, # (http://www.example.com/foo will be redirected to http://example.com/foo) # uncomment the following: # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301] <INSERT REDIRECT RULES HERE>