Reputation: 337
I would like to redirect my entire site to start with HTTPS except 2 subdirectories that I wish to keep on HTTP.
I tried the following but to no avail. Please advice.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/north/index.html$
RewriteCond %{REQUEST_URI} !^/south/index.html$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Upvotes: 0
Views: 30
Reputation: 24468
Try and have you rules like this
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(north|south)(/.*)? [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Upvotes: 2