PHP Header Redirect? Don’t forget to die();

There are some instances where you might need to redirect from the page you are on. For example, the user needs to be logged in so whip them away to the login page.

In PHP, this can be done like so:

header("Location: http://www.mysite.com/login.php");

If you do employ this method, don’t forget that the script may continue executing after the user has gone. Always follow up your header redirects with a die();

header("Location: http://www.mysite.com/login.php");
die();

Are you a Developer, Designer or Copy Writer? Or Looking For One?

Click here to see 100s of jobs updated every day that you can complete to earn good money. Also find that programmer, designer or copy writer you have been looking for - advertise and get the best guy for your job - click here to find out more

Leave a Reply

Make $100,000/Month - Every Month!

It Works! We Make Our Customers Millionaires! Act now and get $600 bonus and a Free Money Making Website! - click to get started