Teshket
asked on
PHP redirect othern than Header Location
Hi,
in my PHP scripts I need to send people to different pages depending on the results of my script, I've been using
header('Location: /yougohere.php');
but I was wondering if there was a better / cleaner solution to sending people to different pages?
in my PHP scripts I need to send people to different pages depending on the results of my script, I've been using
header('Location: /yougohere.php');
but I was wondering if there was a better / cleaner solution to sending people to different pages?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Instead od redirecting you could use the FrontController-Pattern http://en.wikipedia.org/wiki/Front_controller so there is no need for a redirect
In addition to previous answers/solutions you can use following ways (i will note previous posts,too):
+ using header (which you said in your question), and clear header before using it for clear errors or set error_responding to zero.
+ using javascript code which should echo and use die(); in next line.
+ using redirect html tag which should echo and use die(); in next line.
+ using Front Controller Pattern (as hernst42 said in post #36984127)
+ using apache mod_rewriting and in_line editing.
if you need additional information on each ways let me know.
+ using header (which you said in your question), and clear header before using it for clear errors or set error_responding to zero.
+ using javascript code which should echo and use die(); in next line.
+ using redirect html tag which should echo and use die(); in next line.
+ using Front Controller Pattern (as hernst42 said in post #36984127)
+ using apache mod_rewriting and in_line editing.
if you need additional information on each ways let me know.
Open in new window