Page redirect after certain time PHP Page redirect after certain time PHP php php

Page redirect after certain time PHP


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

this is the php way to set header which will redirect you to wherever.php in 5 seconds


Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. (source php.net)


You can use javascript to redirect after some time

setTimeout(function () {   window.location.href= 'http://www.google.com'; // the redirect goes here},5000); // 5 seconds


You can try this:

header('Refresh: 10; URL=http://yoursite.com/page.php');

Where 10 is in seconds.