Just thought i would share this with you guys, it took me quite a bit to work out how accomplish this without breaking MVC and stuff.
This is a .htaccess rewrite for changing between http:// and https:// and back again on a page specific basis.
In this example the secured pages are checkout and process. These can be any pages you want an any number of pages in the format "page1|page2|page3".
Just a little note for novices "^checkout|process" means for these pages, "!^checkout|proces" with the ! means not for these pages.
This is a .htaccess rewrite for changing between http:// and https:// and back again on a page specific basis.
In this example the secured pages are checkout and process. These can be any pages you want an any number of pages in the format "page1|page2|page3".
Just a little note for novices "^checkout|process" means for these pages, "!^checkout|proces" with the ! means not for these pages.
Code:
# Rewrites
RewriteEngine On
# domain.com to www.domain.com
RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
RewriteRule ^(.*) http://www. domain\.com/$1 [L,R=301]
# https to http for all other pages i.e. pages that don't need to be secure
RewriteCond %{HTTPS} = on
RewriteCond %{ENV:REDIRECT_STATUS} = ""
RewriteRule !^checkout|process(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Secure pages
RewriteCond %{HTTPS} != on
RewriteCond %{ENV:REDIRECT_STATUS} = ""
RewriteRule ^checkout|process(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php?rt=$1 [QSA,L]