0

A part of my htaccess that redirects HTTP traffic to HTTPS looks like this:

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I need allow some pages (lets say /page1, /page2) be HTTP only. Thanks!

Tim
  • 103
  • 2

1 Answers1

2

So basically such URIs containing page1 or page2 don't have to be rewritten:

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/page[0-9]
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I simply added another condition check for that to exclude such URIs.

dsmsk80
  • 5,757
  • 17
  • 22