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.
Post a Comment