PHP/HTML – Redirect URL in Seconds

Use the following meta inside <head> to make URL redirection after seconds.

        <meta http-equiv="refresh" content="5; URL=">

You will be redirect to this blog after 5 seconds. =P

You can also make it in PHP.

        header("refresh: 5;");
        echo "You will be redirect in 5 seconds";

Done =)

Reference: Auto Redirect after 5 Seconds..

3 thoughts on “PHP/HTML – Redirect URL in Seconds”

  1. Hmm would you by chance know how to redirect after x seconds only if not logged on. i.e if the person is logged in then the redirect does not execute? I basically am trying to figure out how to allow a person access to a page for 30 sec and then to redirect them to logged/register page and the redirect again to that initial page.


    1. Sure. you should be able to check if a user has logged in or not in PHP, it depends on your authentication design. Use a if block and wrap that redirection logic with ob_start() and ob_end_flush() functions. For more information about the ob_start() and ob_end_flush(), you can refer to PHP – Redirect URL After Form Submission


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s