CodeIgniter Forums
Redirect is not working in Server - 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: Redirect is not working in Server (/showthread.php?tid=49229)

Pages: 1 2


Redirect is not working in Server - El Forum - 02-12-2012

[eluser]A. Wadud[/eluser]
redirect() is not working in remote server but it works in localhost.
now, What can i do?
please help me.


Redirect is not working in Server - El Forum - 02-12-2012

[eluser]InsiteFX[/eluser]
Well maybe if you show your redirect code someone could help you!



Redirect is not working in Server - El Forum - 02-12-2012

[eluser]A. Wadud[/eluser]
My code is like this...and its work on localhost


$type_id=$this->uri->segment(3);

if($type_id)
{
redirect('my/type/'.$type_id);
}


Redirect is not working in Server - El Forum - 02-12-2012

[eluser]timpiele[/eluser]
Try putting a leading forward slash in front of "my" like:

redirect('/my/type/'.$type_id);


Redirect is not working in Server - El Forum - 02-12-2012

[eluser]A. Wadud[/eluser]
But my base url is http://localhost/newspaper/




Redirect is not working in Server - El Forum - 02-12-2012

[eluser]InsiteFX[/eluser]
Did you change your base_url to match your live server?

Code:
$config['base_url'] = '';  // Let CodeIgniter figure it out!

You may also need to change the protocol
Code:
$config['uri_protocol'] = 'REQUEST_URI';



Redirect is not working in Server - El Forum - 02-12-2012

[eluser]A. Wadud[/eluser]
I am using $config['base_url']
because i need it in my
web like <?=base_url();?>


And the last you said that $config['uri_protocol'] = 'REQUEST_URI';
and i already use it.
but its working.


Redirect is not working in Server - El Forum - 02-12-2012

[eluser]InsiteFX[/eluser]
Change this to:
Code:
<?php echo base_url();?>

Your server may not have PHP short tags turned on.



Redirect is not working in Server - El Forum - 02-12-2012

[eluser]A. Wadud[/eluser]
Its working <?=base_url();?>

but redirect is not working.


Redirect is not working in Server - El Forum - 02-13-2012

[eluser]elverion[/eluser]
Are you sure there is no other output before the redirect() call? If there is, that can stop the header from being used.