Welcome Guest, Not a member yet? Register   Sign In
redirect failing on a different server

[eluser]Phil Sturgeon[/eluser]
Recently started doing a bit of work for a client and for some reason my redirect does not work when using the URL helper.

The code:

function index()
        $rules['emailAddress'] = "trim|required|valid_email";
        $rules['userType'] = "trim|required";

        if ($this->validation->run() == FALSE)
            $row = array(
                'email' =>    $this->input->post('emailAddress'),
                'type'    =>    $this->input->post('userType')
            $this->db->insert('Subscriptions', $row);

this does not work. It takes them back to the splash.php view instead of rediecting to the "splash_thanks.php"

So thats lame!

When I swap:

header('Location: /splash/thanks');

it works fine!!

Use Firefox's Headers feature to monitor what the redirect() function is sending to the browser. It should be using a Location redirect, by default. I use redirect() extensively on my sites, so I don't know why it wouldn't work for you.

[eluser]Phil Sturgeon[/eluser]
Exactly. I have used it hell-loads on my two sites and on a few for various clients ALWAYS with no problem. I wouldnt have thought it would matter about PHP versions or anything would it?

It doesnt seem to do anything... just flops. Take a look Kicknote

I just signed up at Kicknote and saw the Thanks page properly. Was it supposed to not work?

Could it be a browser issue instead? What are you using for a browser?

[eluser]the real rlee[/eluser]
Pyro, you running PHP under IIS? Some Windows servers dont like location as noted in docs. Try using 'refresh'

redirect('mypage', 'refresh')

[eluser]Phil Sturgeon[/eluser]
@coolfactor: As I said I changed back to using header('location') shortly after posting as the guy was complaining it wasnt working. Cant make a client unhappy just cause im trying to fix a bit of code >.<

@real rlee: redirect has two options - redirect & location (default). So this cannot be the error as the code that redirect() is using the same method as the one I pasted above... so... wtf?!

Theme © iAndrew 2016 - Forum software by © MyBB