Link to home
Get AccessLog in
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?
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

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

Open in new window

Avatar of Dennie
Dennie

ASKER

Thanks, but how do I force that those 2 exception paths can only be accessed over HTTP?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access