Software, your way.
burger menu icon
WillMaster

WillMaster > LibrarySecurity and Blocking

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Hiding Referrer Information

When you click on a link, the web page where your browser goes to knows where you came from. The information is also in the server logs.

The web page you came from is the "referrer." It contains the link you clicked on; thus, it referred you to the page you clicked to. Referrer information is logged. And any script within the web page also has access to the information.

Some browsers are configured to block referrer information. And some personal firewall software has the same effect. (Which, as an aside, is why software relying on referrer information to make crucial decisions is less than reliable.) Yet, most browsers do provide the information.

Let's suppose you have a secret web page. And it has links to web pages on other domains.

Maybe it is a page for only certain people, or just for yourself. Maybe it's a download page. For whatever reason, the page needs to be secret.

When a link is clicked on the secret page, your secret page is no longer secret. Because it is the referrer, the destination web page, and the domain's server, know where your no-longer-secret page is located.

Ouch.

A relay script can hide the URL of the web page with the link. The referrer then is either the relay script or the information is missing altogether. Your secret page is no longer recorded as the referrer.

Here is a PHP script that does the job.

<html><head>
<meta http-equiv="refresh" content="0; URL=<?php echo($_SERVER['QUERY_STRING']) ?>">
<script language="JavaScript">
window.location="<?php echo($_SERVER['QUERY_STRING']) ?>";
</script>
</head><body></body></html>

Save the above with a file name ending with .php and upload it to your server. Make a note of its URL.

Change the links in the secret page so the URL is the PHP relay script's URL with "?" and the destination URL appended.

As an example, let's suppose this link is in your secret page:

<a href="//www.willmaster.com/blog/">Really good stuff.</a>

Let's suppose the PHP relay script you installed is at URL http://example.com/relay.php

The link to https://www.willmaster.com/blog/ on the secret page now becomes:

<a href="http://example.com/relay.php?https://www.willmaster.com/blog/">Really good stuff.</a>

When the link is clicked, the browser is taken to http://example.com/relay.php and the ?https://www.willmaster.com/blog/ in the URL tells relay.php where to redirect the browser to.

The browser is redirected to https://www.willmaster.com/blog/. The referrer, if any is provided, is the URL of relay.php, not the URL of the secret page.

The referrer, the URL of relay.php, may include the "?" and destination URL. The destination URL is where the browser is going to, not where it is coming from. The location of the secret page is still safe.

No scripts or logs at the destination domain knows or records the location of the secret web page because of that click.

The relay script can be used for any number of links. Simply link to the relay script with "?" and destination URL appended.

Counting Clicks

It may have occurred to you that so long as a script is involved anyway, it could be updated to count clicks.

That's right. It could.

But no need to go to all that work. A PHP script to do that is already made.

  1. It hides the URL of the web page with the link.

  2. It relays the browser to the correct destination.

  3. It counts clicks.

  4. It shortens URLs.

  5. It hides affiliate links.

  6. It hides mailto: links.

  7. It's guaranteed.

The script's name is Go Short URL Pro.

PHP. MySQL. Relatively easy to install. Relatively easy to use. More elegant URLs. A good deal at $35.

To hide the referrer information of secret pages, use a relay script such as the one provided in this article.

Or get all the other benefits by using Go Short URL Pro, instead.

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC