Friday, 15 March 2013

regex - Apache Redirect setting https to http and matching & not matching -


I'm confused about the redirect setting by Apache. It sounds easy, but I can not understand ...

Under http access

  if the carts / and events / * Redirect to https  

I enable sites in / default- http.conf

  & lt; adding this setting; IfModule mod_rewrite.c & gt; RewriteCond% {RewriteEngine on REQUEST_URI} ^ / cars / [OR] RewriteCond% {REQUEST_URI} ^ / events / * RewriteCond% {HTTPS} RewriteRule ^ $ https off (*.): //% {HTTP_HOST}% {REQUEST_URI} [ R, L] & lt; / IfModule & gt;  

Under https access

  otherwise the carts / events / * must redirect to http  < / Pre> 

I want this setting to be site-enabled / default-https.conf

  and lt; IfModule mod_rewrite.c & gt; I am adding to RewriteCond% {RewriteEngine on REQUEST_URI} (^ / carts /) [or] RewriteCond% {REQUEST_URI} (^ / events / *) RewriteRule ^ $ http! (*.): //% {HTTP_HOST}% {REQUEST_URI} [R, L] & lt; / IfModule & gt;  

The problem is

http is working well but https does not work

"itemprop =" text ">

Firstly start Apache .htaccess enabled (if is not already enabled) site to avoid the use of these terms in the root .htaccess:

  RewriteCond% {RewriteEngine on THE_REQUEST} / (CART | events) / [NC] RewriteCond% {HTTPS} off RewriteRule ^ https: //% {HTTP_HOST}% {REQUEST_URI} [l, h, R = 302] RewriteCond% {THE_REQUEST} / (CART | events) / [NC] RewriteCond% {HTTPS} RewriteRule ^ http :! //% {HTTP_HOST}% {REQUEST_URI} [L, Northeast, R = 302]  

To avoid older browser caches, test it in a new browser. And to see better testing in Chrome Dev Tools, which redirects you are getting.


No comments:

Post a Comment