Page 1 of 1

Typo domain redirection

Posted: Thu Nov 29, 2007 5:34 am
by shiznatix
My company has a big list of typo domains that we just have a 301 redirect to our actual website. My boss wants to log all of the cases where someone actually gets sent to us because of a typo domain so I setup this:

Code: Select all

function check_for_domain_confusion()
{
	$domains = array(
              //huge list of domains, all in uppercase
	);

	$referrer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false);

	if (false == $referrer)
	{
		return;
	}

	$url = parse_url($referrer);

	if (in_array(strtoupper($url['host']), $domains))
	{
		$sql = '
			INSERT INTO
				rb_domain_misspellings
					(
						domain, time, full_url
					)
			VALUES
					(
						"'.mysql_real_escape_string($url['host']).'",
						"'.time().'"
						"'.mysql_real_escape_string($referrer).'"
					)
		';
	
		$query = mysql_query($sql) or die(trigger_error('Bad Query Function (check_for_domain_confusion) Line ('.__LINE__.'): <br /><br /><pre>'.$sql.'</pre>', E_USER_ERROR));
	}
}
but this does not work because the redirect is not saved as the $_SERVER['HTTP_REFERER'], its not anywhere. How can I get to know if the users got to our site via one of our other domains?

Posted: Thu Nov 29, 2007 6:09 am
by volka
Are all those typo domains handled by one server? Do you have access to the webserver's access log?

Posted: Thu Nov 29, 2007 6:36 am
by ianhull
What is your redirect?

you could redirect using http://gotooriginaldomain.com/index.php?typodomain=blah

Code: Select all

<?
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: http://www.new-url.com/index.php?typodomain=\"$_SERVER['HTTP_HOST']\"" ); 
?>

Posted: Thu Nov 29, 2007 6:41 am
by shiznatix
We have the domains on godaddy and we use their name servers and have it forwarded to our domain using a 301 redirect.

Posted: Thu Nov 29, 2007 6:43 am
by ianhull

Posted: Thu Nov 29, 2007 6:45 am
by shiznatix
im aware of these but these domains are not hosted on any server we have control over. We just use the godaddy name servers and keep everything there and they do the 301 redirect for us, we don't do it. I suppose we could go through and put them on our server but I would rather not do all that work so is there an easier way to do this?

Posted: Thu Nov 29, 2007 6:48 am
by ianhull
In the godaddy control panel where you type the redirect, can you not put for example.

ebay.co.uk is the main domain

eby.co.uk is a typo


Code: Select all

http://www.ebay.co.uk/index.php?typo=eby.co.uk");

Posted: Thu Nov 29, 2007 7:12 am
by shiznatix
ahha i see an option that i missed before! ok waiting for the domain to finish its thing then hopefully all will work well.