How can I get URL of domain with 301 redirection?

hydrogin

New member
Jun 24, 2006
274
4
0
Is there a php code that I could use to detect or get the URL of the domain redirecting to my landing page?

ie. I set domain.com in Godaddy to permanently 301 redirect to www.mysite.com/index.php

In index.php I need a code to detect the referring url which is domain.com

Thanks in advance!
 


you might be able to get it from $_SERVER['HTTP_REFERER'] but I'm not sure if it would be 100% reliable so set it up like:

if(isset($_SERVER['HTTP_REFERER']))
 
^ then I would have to manually enter a custom url for a lot of domains. I want to be able to bulk forward in Godaddy to 1 specific url which would detect which domain the traffic is coming from
 
Ok so you have domain.com redirecting to mysite.com -- how are the users getting to domain.com to begin with? (Because that is what the referer info is going to show.)

You would need to put a script in the root of each domain that passes it's domain along when it redirects...
 
Ok so you have domain.com redirecting to mysite.com -- how are the users getting to domain.com to begin with? (Because that is what the referer info is going to show.)

You would need to put a script in the root of each domain that passes it's domain along when it redirects...

It will be type-in traffic and other sources which I won't know where. I want to avoid putting a file in each of those domains, which is why I need a way to detect the domain.
 
not sure if this is right - taken from seomoz
301 Redirect

Once the URL is rewritten, you want to make sure that the old URL 301 redirects to the new. This tells the search engines that any link juice the old URL had should now be given to the new URL. It also makes for a good user experience, rather than showing a 404 error page. The server is told URL A should now be URL B.

301 Redirect Process:
User lands on original URL
Using code, mode_rewrite, etc. the 301 redirects URL to the new one, literally changing the URL that is displayed in the browser from the old to the new
URL Rewrite process begins again
##############################
if that is the case can you not install GA on the original site - if the user is actually landing on the original URL and then redirects then GA would record it ?