user1524138
user1524138

Reputation: 1

Exclude one URL from HTTPS redirect

I want to exclude:
http://domain.com/index.php?route=payment/redsys/callback
This is what I have in .htacess

RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

that convert all url to https, how can I exclude the url to be converted to https? thanks

Upvotes: 0

Views: 659

Answers (1)

Joe
Joe

Reputation: 4917

Try using this, just replace directory with the folder directory that you want to stop beocming HTTPs.

RewriteEngine On

#Turns HTTPs on for everything, excluding directory
RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_URI} !^\/directory\/
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301]    

#Turns HTTP on for directory
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} \/directory\/
RewriteRule (.*) http://%{HTTP_HOST}/$1 [L,R=301]

Upvotes: 1

Related Questions