Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

marked as duplicate by ThatGraemeGuy, Ladadadada, Ward, Falcon Momot, Jenny D Sep 10 '13 at 7:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
Thanks for a simple solution :) –  Tim Sep 10 '13 at 7:57

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