DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 3.15 Logging the Referring Page

Problem

You want to record the URL of pages that refer clients to yours, perhaps to find out how people are reaching your site.

Solution

Add the following effector to your activity log format:

%{Referer}i

Discussion

One of the fields that a request header may include is called the Referer. Referer is the URL of the page that linked to the current request. For example, if file a.html contains a link such as:

<a href="b.html">another page</a>

When the link is followed, the request header for b.html will contain a Referer field that has the URL of a.html as its value.

The Referer field is not required nor reliable; some users prefer software or anonymising tools that ensure that you can't tell where they've been. However, this is usually a fairly small number and may be disregarded for most web sites.

See Also

    [ Team LiB ] Previous Section Next Section