I'm pretty sure you could have it in a separate file, that file would have to be included on doc.php as the first thing. You can do virtually anything you want within the if section though, like call up data and so forth, as long as it's not output to the page as text. Once you write to the page, you can no longer redirect.
Yep, include works fine. Here's my redirect.inc page:
PHP Code:
<?php
if(isset($_GET['title']) && $_GET['title'] === 'john'){
header("HTTP/1.1 301 Moved Permanently");
header('Location: ' . $_SERVER['PHP_SELF'] . '?renamed=john&id=3340');
exit;
}
?>
And now, on doc.php all I need is:
PHP Code:
<?php
include 'redirect.inc';
?>
Bookmarks