Force via HTACESS a single URL to run without httpS

0

I have an ecommerce site, it's all running with HTTPS, so I put this code in HTACESS:

RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

It works fine, the problem is that I need a single URL not to undergo this redirection, ie, that single URL needs to be accessible without HTTPS, how do I do it?

    
asked by anonymous 05.10.2015 / 23:34

1 answer

1

I think this is a possible solution to your problem.

Note that I'm using url / test / httpOn and / test / httpOff as an example. Replace these values with the url you want to leave out of HTTPS.

RewriteEngine On
RewriteBase /

# Turn SSL off everything but /test/httpOff
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/test/httpOff
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]


# Turn SSL on for /test/httpsOn
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/test/httpsON
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    
05.10.2015 / 23:52