![]() |
Redirect, it works only with one parameter - 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, it works only with one parameter (/showthread.php?tid=53395) |
Redirect, it works only with one parameter - El Forum - 07-22-2012 [eluser]Alhazred[/eluser] If a wrong page is requested I want to show a "page not found" view. To do this I'm using the redirect() function, but I'm having a problem. If I use redirect('/home/page_not_found'); the page is shown while if I use redirect('/home/page_not_found', 'location', 404); I get a blank page. There is no output before the redirect function, what can cause the problem? Redirect, it works only with one parameter - El Forum - 07-22-2012 [eluser]TWP Marketing[/eluser] redirect() is a CI URL helper function and only accepts the URL parameter. If you want to use more parameters, try the full php http_redirect() Check the User Guide for the specifics of the helper function. bottom of this page: http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html Redirect, it works only with one parameter - El Forum - 07-22-2012 [eluser]Alhazred[/eluser] I read the user guide, and that's why I was using that syntax. In the user guide you can read what follows Quote:redirect() Redirect, it works only with one parameter - El Forum - 07-22-2012 [eluser]TWP Marketing[/eluser] You're correct. Is your redirect() being issued before any attempts to load a view (or fractional view) to the browser? For instance, do you load some header view(s) before making a conditional test for the existence of a page which might trigger redirect? I assume this conditional statement is in your controller. Did you set $route['404_override'] for the default router to use on 404's? |