• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session from http to https


I want to redirect the user to the previous page which he was referring before login. so I kept the link of previous page in a session variable and redirected to that session after login.
It worked fine in local server. But when I moved the same code to main site then it didn;t work.
I think the main cause is separate domains i.e www and after login they move to secure

I have also set $config['cookie_domain'].

Is there any way to accomplish this?


Why is it a different domain? Why does the www change?

Set your cookie domain to ".mysite.tld" (note the leading '.'). Then your cookie will be available to all subdomains.


yeah I have already tried that. I set $_config['cookie_domain']='.xxx.ttt'
but it didn't work.


I don't understand the problem. A cookie is a cookie regardless of whether or not it's a secure request.

As far as I know there is no easy way to maintain session across http and https. You can pass the cookie for the first time through the url, store it in the https side and then you can use the cookie normally.

thanks, i'll try that and get back to u if I could not make it work


I am just wondering where I did wrong:

Let's say a users is viewing a sponsorship page and to sponsor a particular child he has to be logged in. So in view page of sponsorship controller I set

In auth controller:
Login takes the user to secure domain

function login()
if (isset($_SESSION['redirect'])){
$redirect = $_SESSION['redirect'];


In config.php


But here the redirect session variable is blank.

Any ideas where I did wrong??

What you haven't made absolutely clear in your posts is whether the ssl and the non-ssl websites are the same domain. ex. http://samedomain.tld and https://samedomain.tld.

yeah it's different,
http://www.samedomain.tld and https://secure.samedomain.tld.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.