I've got an HTACCESS which contols HTTPS/HTTP redirection based on url, most of it is easy to do except for a specific part.
The basket is dual protocol, some parts of it is HTTP and others is HTTPS namely the part where you enter your shipping and billing address and the part where you enter your credit card information. But the rest, such as /basket/, /basket/delete/, /basket/add/, /basket/modify/ should be HTTP.
I was able to do the the HTTP => HTTPS part but the reverse is quite harder because RewriteCond seems to be an AND, and i need OR...
At the same time, if you guys can help me make it more compact and readable, i'd be really happy, mod_rewrite is not my best tool :)
Right now it looks like this: (Note i know some rules seem to repeat but we have issues with the urls, so i need 2 versions most of the time for the basket part)
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^admin/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !basket/$
RewriteCond %{REQUEST_URI} !basket/add/
RewriteCond %{REQUEST_URI} !basket/delete/
RewriteCond %{REQUEST_URI} !basket/modify/
RewriteCond %{REQUEST_URI} !basket//add/
RewriteCond %{REQUEST_URI} !basket//delete/
RewriteCond %{REQUEST_URI} !basket//modify/
RewriteCond %{REQUEST_URI} !basket/info_panier.js
RewriteRule ^basket/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !panier/$
RewriteCond %{REQUEST_URI} !panier/add/
RewriteCond %{REQUEST_URI} !panier/delete/
RewriteCond %{REQUEST_URI} !panier/modify/
RewriteCond %{REQUEST_URI} !panier//add/
RewriteCond %{REQUEST_URI} !panier//delete/
RewriteCond %{REQUEST_URI} !panier//modify/
RewriteCond %{REQUEST_URI} !panier/info_panier.js
RewriteRule ^panier/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^utilisateurs/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^users/.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} 443
RewriteRule ^produits/.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{SERVER_PORT} 443
RewriteRule ^products/.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteRule ^produits/ /catalogue_files/default/fr.php [L]
RewriteRule ^products/ /catalogue_files/default/en.php [L]
RewriteRule ^panier/ /panier_files/default/fr.php [L]
RewriteRule ^basket/ /panier_files/default/en.php [L]
RewriteRule ^utilisateurs/ /utilisateurs_files/default/fr.php [L]
RewriteRule ^users/ /utilisateurs_files/default/en.php [L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I was thinking of adding something like this:
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} !admin/
RewriteCond %{REQUEST_URI} !users/
RewriteCond %{REQUEST_URI} !utilisateurs/
RewriteCond %{REQUEST_URI} basket/$
RewriteCond %{REQUEST_URI} basket/delete/
RewriteCond %{REQUEST_URI} basket/modify/
RewriteCond %{REQUEST_URI} basket//add/
RewriteCond %{REQUEST_URI} basket//delete/
RewriteCond %{REQUEST_URI} basket//modify/
RewriteCond %{REQUEST_URI} basket/info_panier.js
RewriteCond %{REQUEST_URI} produits/
RewriteCond %{REQUEST_URI} products/
RewriteCond %{REQUEST_URI} pdv/
RewriteCond %{REQUEST_URI} pos/
RewriteRule .* http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
But this script will obviously will not work because RewriteCond is based on AND and not OR. So you can never be in basket/$ and basket/delete/ for example. So i'm stumped as to how to do this...
Thanks