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

But one thing I do: Forgetting what is behind and reaching toward what is ahead, I press on toward the goal for the prize for which God has called me heavenward in Christ Jesus.
— Philippians 3:13-14