How to Redirect Page in PHP after a few seconds without meta http-equiv=REFRESH CONTENT=time How to Redirect Page in PHP after a few seconds without meta http-equiv=REFRESH CONTENT=time php php

How to Redirect Page in PHP after a few seconds without meta http-equiv=REFRESH CONTENT=time


Try use "refresh" header:

header('Refresh: 3;url=page.php');

Also, you can look at this Question Refresh HTTP Header.


There is nothing wrong with using the meta refresh tag.

<meta http-equiv="refresh" content="5;URL='http://example.com/'" />

That tag says wait 5 seconds and redirect to example.com. This tag isn't a problem unless users are on IE6 and it still works, just breaks the history buttons.

Using JavaScript is an option, but make sure you include a link saying "If you are not automatically redirected, please click here". You should actually include that link either way.


php way to set header, will redirect you to test.php in 5 seconds:

header( "refresh:5;url=test.php" );

call before any actual output is sent.

And in javascript:

setTimeout(function () {   window.location.href= url; // the redirect goes here},5000); // 5 seconds