Forum Moderators: phranque
The first rule below works successfully to switch to https:
RewriteEngine On
RewriteRule ^/shop_payment(.*) [%{SERVER_NAME}...] [L,R]
Below is my attempt to get back to http for a url pattern that is essentially not matching the above. I've tried many variations, including using! on the above url pattern.
RewriteCond %{REQUEST_URI} ^products(.*)$
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^/(.*)$ [%{SERVER_NAME}%{REQUEST_URI}...] [R=301,L]
Other info:
My rules are in my httpd.conf file, and this is a simple one server, one virtual host installation connecting to Tomcat. I'm using Apache v2.2
Thanks.
RewriteCond %{REQUEST_URI} [b]^/p[/b]roducts
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^/(.*)$ http://%{SERVER_NAME}[b]/$1[/b] [R=301,L]
Also, if this code is for use on one and only one server, then hard-coding the domain will run faster:
RewriteCond %{REQUEST_URI} ^/products
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L]
Jim