tags:

views:

129

answers:

2

I'm currently using GET to update my click counts into a database and then I redirect the user to the link by using

header('Location: '.$url);

Is there any better alternative way to do this?

Thanks.

+1  A: 

That's how I've done it in the past, and it's worked fine for me.

I believe it's how Google does it too.

RichieHindle
+2  A: 

Why can't you just serve the actual page after updating the count? The only reason Google has to use redirection links is that they don't have control over the destination page.

Matthew Flaschen
Exactly my point. If I want to make sure EVERY visit is counted I probably don't want to hand out any other/real address so I maybe lose track of some visitors. On the other hand why force the user to make two different requests if he only wants one site/download. For search engines this is probably not an ideal method, because they only store the "real url" circumventing your counting scheme. Another thing are screen readers. Don't know how they behave?!
merkuro
merkuro, yes having a raw and a wrapper URL guarantees people are going to visit the raw URL directly, when you don't want that. Just have one URL, and update the count as part of the page generation.
Matthew Flaschen