Hey guys, in the revamping of my engine, OLDTIMES ENGINE, i have situations that i need to redirect players to other pages.
In the first engine, i used meta refresh, <meta type=refresh> or something i dont remember, and now im using header("Location page.php");
What's the best, differences and ups and downs?
[PHP] Header() or Meta refresh to redirect?
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: [PHP] Header() or Meta refresh to redirect?
The meta tag is executed by the browser once the HTML has been parsed and rendered. The header redirect is part of the HTTP network response headers and redirects at the networking level. All in all sending the redirect in the network response is the better option as the browser won't need to render the HTML before it will redirect, it also means people can't tamper the response data to not redirect. I was always advised to use the meta tag in the past, but I to this day still cannot figure out why. It might be something to do with the HTTP standards back in the day. A HTTP 303 redirect header as the response is the most convenient way in my opinion.
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Conclusion:
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Conclusion:
Code: Select all
header('Location: whereEver.php');
Fighting for peace is declaring war on war. If you want peace be peaceful.
- vitinho444
- Posts: 2819
- Joined: Mon Mar 21, 2011 4:54 pm
Re: [PHP] Header() or Meta refresh to redirect?
Nice, im using the right one then
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: [PHP] Header() or Meta refresh to redirect?
Chris is back!