htaccess config for runcloud

Enforce HTTPS redirect on RunCloud NGINX + Apache2 Hybrid setup

Normally, you are required to add the following lines to your WordPress .htaccess file:

RewriteCond %{HTTP_HOST} domainname\.tld [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domainname.tld/$1 [R,L]

The above however or any other such rule, would not work on RunCloud NGINX + Apache2 Hybrid setup. You will be getting redirection error with the above. You have to instead add the following to make it work:

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]

Let me know if this has helped you!

Source

Published by

Hassan

Full time G33K for the last 20 years. I write about Technology.

One thought on “Enforce HTTPS redirect on RunCloud NGINX + Apache2 Hybrid setup”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.