Hi,
I need to force redirect all pages for websites hosted by my web server to HTTPS except for one site which should force all traffic over HTTP. How to write rewrite rule in Apache for this condition?
For example siteA.test.com should be accessed over HTTP only on port 8080
siteB.test.com should be accessed over HTTPS only on port 8443
siteC.test.com should be accessed over HTTPS only on port 8443
This is what I have tried:-
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^siteA.*$
RewriteRule (.*) https://%{HTTP_HOST}:8443/$1 [R,L]
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^siteA.*$
RewriteRule (.*) http://%{HTTP_HOST}:8080/$1 [R,L]
The problem is that if I access siteA over https it doesn't redirect. siteB redirects to https from http OK.
Many thanks