Hi Rowan,
Here's some code which might help - run this on every page...
if (!isset($_SESSION['referer']) && isset($_SERVER['HTTP_REFERER']) &&
strpos($_SERVER['HTTP_REFERER'],'http://www.test.com') === false) {
$_SESSION['referer'] = $_SERVER['HTTP_REFERER'];
}
Next, when you want to show the alternative content, test against that
session variable you just set...
if (isset($_SESSION['referer']) && ($_SESSION['referer'] ==
'http://www.test2.com')) {
//different banner
} else {
//default banner
}
This code hasn't been specifically tested, but I modified this from
working code which has been working nicely for years.
Harvey.
On 19/08/2010 11:33 a.m., Rowan wrote:
Hi guys,
I've recently developed a website which has two domains, a primary
(lets say test.com) and a secondary (test2.com)
Test2.com uses a 301 Moved response to redirect the user to Test.com -
however the client is interested to know if I can somehow display the
landing page differently for users which have come from the secondary
domain (A different banner for instance)
To do so I was banking on using the $_SERVER['HTTP_REFERER'] variable,
which I'd hoped would contain the secondary domain as its value when
this redirection was occurring. The problem is that the secondary
domain is stored in the ref variable only the first time, if at all,
and is otherwise empty when attempting to access the website using the
secondary domain.
Can anybody suggest a workaround for this?
Cheers!
Rowan
--
Harvey Kane
Phone:
- Auckland: +64 9 950 4133
- Wanaka: +64 3 746 8133
- Mobile: +64 21 811 951
Email: [email protected]
If you need to contact me urgently, please read my email policy
www.ragepank.com/email/
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]