Skip to content
Advertisement

How to find out from what URL a user came from

I work at a company, lets call it ‘A’, that got taken over by company ‘B’ but basically still is its own company.

Now I have made an application, but my boss and I thought it would be a nice idea to change the design of the page depending on from which of the two company’s the user is from.

The company’s both have their own login site and system. And if there is maintenance or a failure on the system they get redirected to my application which says this.

I am wondering if there is a way to define from which of the two URL’s the user came from so I can change the design of the site to that company.

P.S. the application is written in PHP

Advertisement

Answer

To handle such cross site communication, I would use Cookies.

Redirect the client sites to a script on the maintenance server, which sets a cookie and then further redirects to a page, which on hand the Cookie can custom the content.

Redirection link on client site

http://www.example-maintenanceserver.com/setcookie.php?client_id=123

The setcookie.php (maintenance server)

<?php
    setcookie("client_id", $_GET['client_id']);
    header("location:custom_client_page.php");
?>

The custom_client_page.php (maintenance server)

<?php
    $client_id = $_COOKIE['client_id'];
    .....
    // tailor custom content for client id
?>
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement