Cannot modify header information – headers already sent by by (output started a
-
I added this code to the top header.php file (note: there are no blank spaces before the code)
<?
// if the user doesn’t have a cookie set, take them to the splash page
if(!isset($_COOKIE[‘no_splash’])&&((strpos($_SERVER[‘HTTP_REFERER’],get_bloginfo(‘home’))===false)&&!$_SERVER[‘QUERY_STRING’])) {
header(‘Location:https://myurl.php’); // Redirect code
} else { ?>and I tried both with and without a closing tag at the end of the page.
this is the code I have on my splash page:
<?// Set the expiration time to 1 day – 60 seconds * 60 minutes * 24 hours * 1 day
// You can change the (1) to any number of days you like
$expire = time() + 60*60*60*360;// set the cookie using the above expiration time
setcookie(“no_splash”, “1”, $expire);//contents here
?>The splash page is in WordPress Install Folder
- The topic ‘Cannot modify header information – headers already sent by by (output started a’ is closed to new replies.