I use Drupal, with a complicated multi-Domain setup, and have a local development site, that uses (locally) the dev. subdomain.
So I want a .htaccess file that can be used on production AND development.
The production site is used with HTTPS, and there is a HTTP->HTTPS redirect in the htaccess file.
I just want to NOT redirect to https if on the .dev subdomain:
RewriteBase /
# use website without "www."
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
# force HTTPS, but don't if on local development site
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteCond %{HTTP_HOST} !^dev\.(.+)$ [NC]
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
But this does not work, and creates a loop redirect. But I can't see why. Any hints?
Asked by nerdoc
(151 rep)
Apr 18, 2019, 10:57 AM
Last activity: Jul 30, 2020, 07:21 PM
Last activity: Jul 30, 2020, 07:21 PM