Server-Side Redirect in PHP
Tuesday, April 15, 2008

Took me long enough to find this.  One thing that I found somewhat frustrating about PHP was the inability to do a server-side redirect.  Well, apparently, you can.  Here is the code:

<?php
header("location:http://www.carolingianrealm.info/");
?>

I found this tip on CodingForums.com.

Relative URLs are permitted, as are query string parameters.

The advantage of this technique over an include/return statement is that the new URL is reflected in the browser's location bar.

I've updated my Wander link accordingly.

Leave a comment

Faith is called upon, and that right often, to wait in patience before God, and is prepared for God's seeming delays in answering prayer. Faith does not grow disheartened because prayer is not immediately honored; it takes God at his Word, and lets him take what time he chooses in fulfilling his purposes, and in carrying on his work.
— E.M. Bounds
The Necessity of Prayer