php script redirecting code problem

Posted by tibin mathew on Stack Overflow See other posts from Stack Overflow or by tibin mathew
Published on 2010-04-29T09:46:33Z Indexed on 2010/04/29 9:47 UTC
Read the original article Hit count: 271

Filed under:
|

hi,

i'm using a php script for redirection after detecting the search word to my websiter from the search engines .

and my redirection code is working fine

but for some keywods i wat to stay in the same page. for that lines of code i'm getting a warning message in that pages.

Warning: headers already sent (output started at /home/friendsj/public_html/index.php:2) in /home/friendsj/public_html/index.php on line 20

below is the code i used in that pages

$ref=$_SERVER['HTTP_REFERER'];

if(strstr($ref,"test")) {

$url="http://www.howtomark.com/robgoyette.html";

   }

elseif(strstr($ref,"mu+word+gmail")) {

$url="http://www.howtomark.com/marketbetter.html";

} else { if(strstr($ref,"how+to+market+better")) {

   }

   }

if($url !="")

{
 header("Location:$url");

 }

© Stack Overflow or respective owner

Related posts about php

Related posts about redirection