Hi,
I know there is lots of topics regarding my question. I checked them all and tried them out but can't make it work. I need to rewrite http to https on some pages only. After visiting https pages the URL would go back to http. This is what I have so far:
# Rewrite Rules for domain.com
RewriteEngine On
RewriteBase /
#Rewrite www to domain.com
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
#Rewrite to https
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /secure.php
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
#traffic to http://, except secure.php
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /secure.php
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
When I skip the last set of rules (traffic to http://, except secure.php) the secure.php page loads as https and is encrypted. FINE. With the last set of rules (traffic to http://, except secure.php) the URL rewrites to https, turns blue (SSL) for a second and disappears (no SSL) but the URL is still https.
Any idea? Jacek