1

I have the Drupal 8 site was working with HTTP on the port 80. I switched it to HTTPS with port 443. I got the problem for ERR_TOO_MANY_REDIRECTS when accessing some images from physicals path.

For example path: https://www.example.com/theme/sites/basic/img/fileimage.png

It happened on some files which are display on the pages. I tried access other files on the same level folder "img" is working. (i.e img/logo.png)

I guess it's cache problem. Here what I did: - Clear cache - Drush cr - Deleted some special table within cache_ inside. - I stop mysqld, it's still happened.

Here is my .htaccess:

# ensure www.
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

From my admin/config/Basic Site Setting. I still saw

Default front page: http://www.example.com

It should be https? How I can resolve it? Thanks

2 Answers 2

0

Try this out -

# ensure www.
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]

# ensure https
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
1
  • It's not working, I think possible on cache issue.
    – Diep Tang
    Commented Jan 23, 2017 at 7:44
0

On Drupal 8 I fixed it by change

RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]

to

# 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} off
RewriteRule ^ - [E=protossl:s]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.