Welcome to WebmasterWorld Guest from

Forum Moderators: phranque

Message Too Old, No Replies

How to find the true redirect of a page

4:28 pm on Jun 30, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 28, 2001
votes: 0

How can I determine the original site that is redirecting to our site using their affiliate code?

Someone has registered a knock off of our domain name and on their site they are redirecting traffic to our site.

As the page loads I can see the affiliate code pass by the status bar quickly - argh! I need to see this ;-)

Also, something else that I am seeing more frequently is someone throws up a site, splits it into 2 horizontal frames. One of the frames is 100% height and is being fed with our website. The other frame is of course whatever % is left over out of 100% (my math isn't great but I believe that is 0%) but I cant' see the source of that frame - it appears to be encrypted!

I can send actual examples if necessary :-)


10:59 pm on June 30, 2005 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 18, 2002
votes: 0

As the page loads I can see the affiliate code pass by the status bar quickly

You aren't clear as to whether the page that's loading is on your site or on the other site. If it's on your site, you should be able to look at your log file to determine what page and affiliate code was being requested. If the affiliate code is on the other site's page, you might find the answer in the referrer field on your site's logs.

Another option would be to use the server header checker [webmasterworld.com] to see what comes out when you enter the URL. If it's a redirect, you should be able to see what it is redirecting to, and dig down from there until you actually get to your site.

I cant' see the source of that frame

you might try using the view-source option in Firefox or IE. Just type in the address bar view-source:http://www.domain.com and the frameset page should display. You can then figure out the URI of the invisible frame, and then access it directly, or use view-source on it to figure out what's up.
6:39 pm on July 1, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 17, 2003
votes: 0

Here's a little perl script that you can use to get the answer:

use LWP::UserAgent;
our $ua = LWP::UserAgent->new(
cookie_jar => { },
requests_redirectable => [ ],
for my $url (@ARGV) {
my $r = $ua->get($url);
if ($r->status_line =~ m/^30[12]/ and $r->header('Location')) {
printf "%s ==> %s\n", $url, $r->header('Location');
$url = $r->header('Location');
printf "%s ==> %s\n\n", $url, $r->status_line;

Save it to something like show-redirect.pl and then invoke as:

perl show-redirect.pl http://www.example.com

It will print the source and target of the redirect repeatedly, and show the HTTP status code for the final GET. For this to work, you do need to have the LWP-Bundle installed (and of course perl).