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

We do not know what we ought to pray for, but the Spirit himself intercedes for us with groans that words cannot express.  And He who searches our hearts knows the mind of the Spirit, because the Spirit intercedes for the saints in accordance with God's will.
— Romans 8:26-27