tags:

views:

44

answers:

2

Hello!

I have two domain for my site. The main site is example.net, and I have example.com.

If someone type example.com (or www.example.com, http://example.com or whatever) then I redirect them to example.net (my provider set domain redirecting).

So, is it possible, to take into a php variable if someone come from .com or directly type .net?

Thank you

A: 

why don't use just redirect them to .net?from=com ?

SilentGhost
I've edited your answer so it makes sense with Gumbo's edits.
Dominic Rodger
If i use this simple redirect, then my site seems duplicated for robots.
Holian
And why should'nt it do if it IS a duplicate?
FractalizeR
+2  A: 

If the host is doing the redirecting and you don't have control over it, then it might be worth looking at $_SERVER['HTTP_REFERER'] depending on how they are doing the redirect. Note that this is header not guaranteed to be there and can be spoofed by the client.

Tom Haigh
certainly don't follow the answer below, it would just create further issues with proper indexing and possibly duplicates.
dusoft
If someone type MYSITE.COM (wich is auto-redirect to .UK), then HTTP_REFERER will be MYSITE.COM? I know if i use header (location...) in php, then http_referer will be the source url. But if the service provider do the redirecting HTTP_Referrer do the same? So will be the source URL?
Holian
It depends I think on how the redirection is done.
Tom Haigh