title: How to restrict user access to subdomains
body: <p>I was hoping for some advice on how to restrict user access to subdomains.<br>
  The subdomains should only be accessed with a valid <code>$_GET</code> param, like <code>www.domain.com/index.php?mykey=12345</code></p>
  
  <p>I have a Yii backend which controls these keys, but cant find a good way to restrict access.  I have tried an <code>.htaccess</code> rule to pass all traffic to index.php, which then does something in the backend controller like </p>
  
  <pre><code>file_get_contents('/var/www/'. $requested_file) ;
  RewriteRule ^(.*)$ http://www.domain.com/index.php/$1
  </code></pre>
  
  <p>Obvious security risk I know.  It sort of works, but has problems with images as it passes ALL traffic through <code>f_g_c().</code></p>
  
  <p>Hopefully there is a more straightforward way of doing this.</p>
  
  <p><strong>Edit</strong>: Ideally I would not like to make the presence of the back-end visible to users.  Hence why I'm not using the obvious straightforward methods.  </p>