Jolly Good question that, one I have just these last few weeks had to
tackle. I searched around a bit on the subject and came up with a few
articles - none of which really did exactly what I wanted, and I figured
it just had to be easy than this. 

So in my webroot htaccess I added the following two lines to do most of
the magic for me (this is not complete but these are the lines that do
it):

RewriteRule ^secure/(.*)$ https://domain.com/$1 [QSA,L]
RewriteRule ^ns/(.*)$ http://domain.com/$1 [QSA,L]

When I want to go to a secure econnection
I call my link

http://domain.com/secure/controller/action

and I get redirected to the HTTPS connection

https://domain.com/controller/action

and to get back to HTTP I call

https://domain.com/ns/controller/action

and I get redirected to the HTTP connection

http://domain.com/controller/action

then in my controller beforeFilter, actions or in my app_controller I
can enforce this by doing:


if (!env("HTTPS")) {
        $this->redirect('secure/controller/action');
}


        
Like I said, this may not be the "best practice" way to do it, but to me
it did it good enough given the situation I was addressing. Criticism
and feedback most welcome.

Hope its helpful to you.


websta*




-----Original Message-----
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Friday, 20 April 2007 11:51 a.m.
To: Cake PHP
Subject: Silly HTTPS quesiton...


Upon login, I'd like to send a user to a HTTPS url for a secure
connection. All subsequent links around the site need to maintain
this. How is this accomplished in cake?




__________ NOD32 2205 (20070419) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to