What do I need to add to this code to make it only include file.php if on the homepage? <?php include("file.php"); ?> Thank you.
I'd do an if where you look at $_SERVER['REQUEST_URI'] (I think), do a var_dump($_SERVER) to see what your options are.
Assuming your home page is index.php (and you have mod_rewrite urls) you could do something like this: $base = basename( $_SERVER[ 'PHP_SELF' ] ); if ( ($base == 'index.php') && (dirname($_SERVER['PHP_SELF']) === '/') ) { include_once "file.php"; } PHP: