CodeIgniter Forums
Rewriting away from SSL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Rewriting away from SSL (/showthread.php?tid=59573)



Rewriting away from SSL - El Forum - 10-22-2013

[eluser]Unknown[/eluser]
Hi

I have been referring to an oldish thread which appears to make this work: http://ellislab.com/forums/viewthread/86113/P15

I am trying to force the checkout page to be served via https and then all other pages served via http (no SSL). I can get the first half of this problem to work, but when I enable the rewrite to process all the other pages via standard http, it breaks the first rule and the page gets served via the index.php url such as:

Code:
http://www.mysite.com/index.php/?checkout

instead of:

Code:
http://www.mysite.com/checkout

Here is the code I am using:

Code:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (checkout) [NC]
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(checkout)
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

Any help would be really appreciated.

Jonathan