Jump to content

if redirected from another url ?


Kane250

Recommended Posts

Hi,

 

I have a website set up with two domain names, 1 main domain for the site, and 1 that forwards you to the main domain name.  I'm trying to set a variable where I can do one thing if you came to the normal url or do another if you were forwarded from the redirecting url. 

 

To make it a step harder, I don't want to do the simple solution and pass a GET variable from the redirect url to the main page.

 

I tried using

 

echo $_SERVER['HTTP_REFERER'];

 

But this obviously doesn't work with domain forwarding, as I am getting an undefined variable error.

 

Anyone know of other methods?

 

Thanks in advance!

Link to comment
Share on other sites

Well I'm trying to find out from my IT dept here if it is being done a different way, but I do believe that it is a standard 301 redirect.  The urls come in from other pages, and even if I click back to the homepage from an internal page on the site.  The only undefined one is when I get redirected from the other domain.

Link to comment
Share on other sites

The 301 url will not send a referrer header hence you cant pick this up.

I would use a 301 to a landing page on the target domain where you can record that a redirect has occurred. Once logged use another 301 to the base url i.e.

 

www.abc.com -> 301 redirect to www.xyz.com/landing.php

www.xyz.com/landing.php -> record referral -> 301 redirect to www.xyz.com

www.xyz.com

Link to comment
Share on other sites

Thanks.  Since it seemed like the only way to do this was to make a landing page, I actually ended up going for the easier route and just passing a variable through the forwarded URL.  It's not as clean, but I think it's as simple as I can make it work at this point.

 

Thanks for your help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.