I don't know what you are planning to do but this seems to be a bad approach.
Add this to your index.php
:
Old answer
/*
if(!isset($_GET['p'])){
header("Location: index.php?p=home");
}
*/
Edited:
Since it seemed like your header()
function did not work because of probably any output before the function call, changed answer to:
$page = basename($_SERVER['PHP_SELF']);
if($page=='index.php' && !isset($_GET['p'])){
echo '<meta HTTP-EQUIV="REFRESH" content="0; url=index.php?p=home">';
}
$p = (isset($_GET['p'])?$_GET['p']:'home');
if (file_exists("pages/{$p}.php")) {
include("pages/{$p}.php");
}