Forum Moderators: coopster

Message Too Old, No Replies

How to redirect an ad- click to an affiliate site

which forwarding method is the right one?

         

the_nerd

2:04 pm on Jun 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of placing affiliate Banners and Links on my pages I'd like to use links like mysite.com/afflink89.php on the pages where the banners are located. One reason to do this: I can count when something was clicked on without having to rely on outside stats.

Now, if the surfer lands on the counter page - how do I move him on to the final page/link? Should I use 302/301 - or something completely different?

Any help appreciated,

nerd.

eelixduppy

3:51 pm on Jun 4, 2008 (gmt 0)



Just change the location header. It would be like this:

#grab affiliate ID
#insert stats into database, file, etc based on ID
#
#redirect to corresponding page
header("Location: $url");

wheelie34

9:25 am on Jun 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am using the following code to count clicks, when I run xenu the redirects create a 302 is that ok for search engines, how will they see it


$sql = "UPDATE TABLE SET clicks=clicks+1 where url='$url'";
if (mysql_query($sql, $dblink))
{
header("Location: [$url");...]
}
else
{
}
?>
<head>
<title>Go</title>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META NAME="GOOGLEBOT" CONTENT="NOARCHIVE">
<META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW">
</head>

Is it the correct method?

the_nerd

1:13 pm on Jun 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



wheelie34: Is it the correct method?

thanks guys. So using "header("Location: [$url");"...] results in a 302 - and that is the correct way to do it?

eelixduppy

4:36 am on Jun 7, 2008 (gmt 0)



Sure.

wheelie34

3:48 pm on Jun 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just noticed something with the above method, when creating a sitemap xml file the counter increments is there a way to prevent this happening?

And would spiders make it increment too?

eelixduppy

7:20 am on Jun 27, 2008 (gmt 0)



This file shouldn't be included in your sitemap nor indexable by robots. Change your robots.txt file accordingly.