Forum Moderators: coopster
Redirecting may be dangerous in terms of SEO, so is there a way to display dynamic content according to where the visitor comes from?
I've seen a particular site do this, however, the extension on the landing page is .html. If need be, I will sticky you the URL of the page so that you can see it in "detail".
addtype application/x-httpd-php .php .html
For the dynamic serving based on referer data you could analyze the referer using $_SERVER['HTTP_REFERER'] [ca.php.net] and then include content based on parsing the query string.
I use this piece for an apache log parser to chop up query strings. This catches most of the query strings and grabs out the keywords and increments a keyword array. This is pulled from a large script so it may have some unrelated vars in there but it does work quite well.
It does a ton of other stuff at the beginning but these lines are relevant
$line = fgets($fp)
$qusplit = split('"',$line);
$queryarr = parse_url($qusplit[3]);
these are used because it needs to get the referer from the logfile in your case it could be
$queryarr = parse_url($_SERVER['HTTP_REFERER']);
if (!empty($queryarr['query'])) {
parse_str($queryarr['query'],$breakuparr);
if (isset($breakuparr['encquery'])) {
$qs = $breakuparr['encquery'];
} else if (isset($breakuparr['q'])) {
$qs = $breakuparr['q'];
} else if (isset($breakuparr['p'])) {
$qs = $breakuparr['p'];
} else if (isset($breakuparr['source']) && $breakuparr['source']!= "NSCPTop") {
$qs = $breakuparr['source'];
} else if (isset($breakuparr['query'])) {
$qs = $breakuparr['query'];
} else if (isset($breakuparr['Keywords'])) {
$qs = $breakuparr['Keywords'];
} else if (isset($breakuparr['cid']) && isset($breakuparr['s'])) {
$qs = $breakuparr['s'];
} else {
$qs = "";
}
// end query finding stuff
$qs = strtolower(trim($qs));
if (!empty($qs)) {
$qs = str_replace('\"','',$qs);
$qs = str_replace('+','',$qs);
}
}