title: Is it possible to allow traffic from only one site to a page?
body: <p>I've been banging my head against this for a week. I have a page that we want to only be accessible from another domain. Is it possible with PHP or .htaccess? Ive posted a couple attempts to do this on here, nothing seems to work. Please help!</p>
  
  <pre><code>&lt;?php
  
  $allowed_domains = array('dirtybirddesignlab.com','foo.com');
  
  $REFERRER = $_SERVER['HTTP_REFERER'];
  
  if ($REFERRER == '') {
      exit(header('Location: 404.php'));
  }
  
  $domain = substr($REFERRER, strpos($REFERRER, '://')+3);
  $domain = substr($domain, 0, strpos($domain, '/'));
  
  if (!in_array($domain, $allowed_domains)) {
      exit(header('Location:404.php'));
  }
  
  ?&gt;
  </code></pre>