GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech How to preserve referrer url when redirecting with php to affiliate site (https://gfy.com/showthread.php?t=1253593)

Cyber Fucker 03-23-2017 02:02 PM

How to preserve referrer url when redirecting with php to affiliate site
 
Gfy techs help! :helpme

I made a page with simple redirection, something similar to:

Code:

header("HTTP/1.1 301 Moved Permanently");
header("Location: $_SERVER['QUERY_STRING']", true, 301);
exit;

It works as intended, but I can't see the referring url in affiliate programs stats. :helpme

mce 03-23-2017 02:05 PM

I'd love to see the answer too. Here's a bump for you, my man.

Klen 03-23-2017 02:29 PM

Hmm that should do the job, could be simply how program stats are broken or they have multiple redirects which deletes original refferer so you cant do shit with it. Ask sponsor for tracking id, where you would put your refferer url.

Cyber Fucker 03-23-2017 03:09 PM

Nah, that's not the sponsor thing I think, at least not a single case, I could be wrong though. I tested on a few. I think it's just the way php and web browsers work, same with javascript, it would not pass the referrer. But server redirection on the other hand like in htaccess would. I believe though there must be some way to trick browsers with php to pass it. Reading stackexchange at the moment, but the more I read the more mess is in my head and it's already suffering tonight from a headache. :Hollering So I have thought, that perhaps someone here done it before and will save me a bit of time and struggle.

Bladewire 03-23-2017 04:01 PM

Code:

<?php
 
$redirect_page = "https://www.example.com/page-two.php";
 
if($_SERVER['QUERY_STRING']){
 
$query_sign = "?";
 
}else{
 
$query_sign = "";
 
}
 
header("Location: $redirect_page.$query_sign".$_SERVER['QUERY_STRING'], true, 301);
 
exit;
 
?>


sarettah 03-23-2017 08:54 PM

Quote:

Originally Posted by Cyber Fucker (Post 21649996)
Gfy techs help! :helpme

I made a page with simple redirection, something similar to:

Code:

header("HTTP/1.1 301 Moved Permanently");
header("Location: $_SERVER['QUERY_STRING']", true, 301);
exit;

It works as intended, but I can't see the referring url in affiliate programs stats. :helpme

Easiest way I know is to do a HTML Meta refresh. The referer gets passed that way.

Code:

<meta http-equiv="refresh" content="0; url=page_to_go_too">
So, if you are doing it via php, something like this:

Code:

<html>
<head>
<meta http-equiv="refresh" content="0; url=<?php echo $_SERVER['QUERY_STRING']; ?>">
</head>
<body>
</body>
</html>


Bladewire 03-23-2017 09:38 PM

Quote:

Originally Posted by sarettah (Post 21650836)

Code:

<html>
<head>
<meta http-equiv="refresh" content="0; url=<?php echo $_SERVER['QUERY_STRING']; ?>">
</head>
<body>
</body>
</html>



Paz 03-24-2017 04:54 AM

Quote:

Originally Posted by Cyber Fucker (Post 21649996)
It works as intended, but I can't see the referring url in affiliate programs stats. :helpme

Some good suggestions already, also if you are redirecting from https to http you won't pass the referrer plus some browser settings and devices don't pass referrer as well.

freecartoonporn 03-24-2017 06:06 AM

Quote:

Originally Posted by Bladewire (Post 21650890)

:1orglaugh:1orglaugh:1orglaugh

sarettah 03-24-2017 07:48 AM

Quote:

Originally Posted by Bladewire (Post 21650890)

Quote:

Originally Posted by freecartoonporn (Post 21651562)
:1orglaugh:1orglaugh:1orglaugh



Is there a problem with my solution? Or am I mis-interpreting something?

Proof of concept:

http://www.hatterasdesigns.com/testr...test_redir.php

Code:

<html>
<head>
<meta http-equiv="refresh" content="0; url=<?php echo $_SERVER['QUERY_STRING']; ?>">
</head>
<body>
</body>
</html>


The madspiders.com page simply echoes the referer

Code:

<?php
echo "referer is " . $_SERVER['HTTP_REFERER'];
?>

.

woj 03-24-2017 07:55 AM

you are supposed to do the opposite (hide the referer), so the sponsor doesn't steal your traffic sources/methods/etc... :error

Cyber Fucker 03-24-2017 08:00 AM

Quote:

Originally Posted by woj (Post 21651844)
you are supposed to do the opposite (hide the referer), so the sponsor doesn't steal your traffic sources/methods/etc... :error

Maybe you are right. I was thinking about it. All in all I got details on my end in my own logs (that was the whole purpose of this redirection page, so that programs don't cheat me on the actual numbers) and also there are campaign tools in most programs that can shed some light on the question where the traffic comes from. So yeah, maybe you are right.

Bladewire 03-24-2017 02:39 PM

Quote:

Originally Posted by sarettah (Post 21651808)
Is there a problem with my solution? Or am I mis-interpreting something?

I was complimenting you on the clean code Sarettah! Line 3 specifically :thumbsup


shake 03-24-2017 03:16 PM

Quote:

Originally Posted by woj (Post 21651844)
you are supposed to do the opposite (hide the referer), so the sponsor doesn't steal your traffic sources/methods/etc... :error

I used to always re-direct through a fake tgp to show sponsors a legit looking referer.

sarettah 03-24-2017 04:52 PM

Quote:

Originally Posted by Bladewire (Post 21652882)
I was complimenting you on the clean code Sarettah! Line 3 specifically :thumbsup

Ok, I wasn't sure how to take it. Sorry about that.

.

freecartoonporn 03-24-2017 10:21 PM

Quote:

Originally Posted by sarettah (Post 21651808)
Is there a problem with my solution? Or am I mis-interpreting something?

i :1orglaugh about the GIF.


All times are GMT -7. The time now is 03:12 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc