Force via HTACESS a single URL to run without https

Asked

Viewed 271 times

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 well, the problem is that I need a single URL not undergo this redirection, IE, this single URL needs to be able to be accessed without HTTPS, how to do?

  • what is the url you want to leave out of HTTPS?

1 answer

1


I believe this is a possible solution to your problem.

Note that I am using the /test/httpOn and /test/httpOff url 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]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.