I'm using the rewrite rules below to redirect 2 php pages to https (to protect user data), but whenever I click on any links on those php pages they redirect with https enabled and the page does not display correctly.
The rules at the bottom were meant to redirect any other pages back to http, but they are not working. Any advice would be much appreciated!
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/securepage1.php$ [NC]
RewriteRule ^(.*)$ https://www.example.com$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/securepage2.php$ [NC]
RewriteRule ^(.*)$ https://www.example.com$1 [L,R=301]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/securepage1.php$ [NC]
RewriteCond %{REQUEST_URI} !^/securepage2.php$ [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301]