Avatar of Dennie
Dennie
 asked on

Apache http to https except 2 paths

Hi,

I've got this rewrite rule to redirect all http request to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Open in new window


I want to make an exception for 2 paths (/a and /b). These paths can only be accessed over HTTP. How do I do this?
Apache Web ServerWeb Servers

Avatar of undefined
Last Comment
Steve Bink

8/22/2022 - Mon
Steve Bink

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/?(patha|pathb)
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Open in new window

Dennie

ASKER
Thanks, but how do I force that those 2 exception paths can only be accessed over HTTP?
ASKER CERTIFIED SOLUTION
Steve Bink

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck