you don't need to access the header for that, .. just use this
PHP Code:
if ($_SERVER["REQUEST_URI"] == 'index.php') {
header('location: index.php?homepage');
exit();
}
why are you using just 'homepage' after the '?' .. usually it would be a key/value pair .. i.e. index.php?page=homepage.
and in that case, since both scripts are index.php, then i would just add something like this at the top of index.
PHP Code:
if (!$_GET['page']) {
$_GET['page'] == 'homepage';
}
you don't need to really bother with a redirect.