Call us Toll-Free:
Email us


How to: Prevent Direct Access to upsell pages

Dawn Rossi, 05-28-2009
Our information-marketing clients sales-process typically follows these steps:

Page 1: Opt-in page
Page 2: Sales letter
Page 3: Checkout form
Page 4: Upsells 1,2,3 etc.
Page 5: Thank you page

How do you prevent users from directly accessing anything but page 1?

You could use cookies or session variables, but the easiest way to block users from directly accessing any "pages in the middle", is to validate using the HTTP_REFERER string (what url the user came from).

If the user is directly hitting pages 2 to 5, or arriving there from any third party sites, the HTTP_REFERER string will not match your domain. You can then redirect the user back to Page 1 and force following the process as it was intended.

The code below does the trick:

= parse_url($_SERVER['HTTP_REFERER']);
$referring_host = $referring_host['host'];
if (
// We got here from a different domain (or bookmark)
// Redirect to page 1
Header("Location: page1");

If you're using the SoftwareProjects Shopping Cart, the above can be implemented with a single call to do_blockdirectlinking


// Include SPI shopping cart

// Block direct access to this page
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

Post your comments

Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.

About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions