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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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.