Pages

PHP Header Location vs Header Refresh

This is very interesting tips about using PHP to do Redirect.

PHP Header with Location seem to redirect faster than using Refresh. Looks like Refresh will create the <meta> refresh tag and depends on the Browser to redirect. In FireFox, it will actually show a blank page before it redirects to destination page.

With Location option, it seems to redirect directly without showing the blank page.

header("Refresh:0;url=". $this->config->item('PF_HTTPS_ROOT') . '/member/signin/');


header('Location: ' . $this->config->item('PF_HTTPS_ROOT') . '/member/signin/', TRUE, 301);

Either ways, it will have a round trip between Server and Client's browser.

No comments:

Post a Comment

Thank you for your feedback. If you find the tip and trick useful, feel free to share with your friends on Facebook, Twitter and G+!