title: htaccess in subbdomain skip redirection rule
body: <p>I'm trying to let the visitors of my subdomain only direclty in, when using a specific subdomain link format. I know that this would block SEs too, but I don't want the subdomain to be indexed anyway.</p>
  
  <p>The allowed link should look like this:</p>
  
  <blockquote>
    <p>subdomain.maindomain.com/aaa/bbb/ccc</p>
  </blockquote>
  
  <p>and should be rewritten to this:</p>
  
  <blockquote>
    <p>subdomain.maindomain.com/index.php?a=aaa&amp;b=bbb&amp;c=ccc</p>
  </blockquote>
  
  <p>everthing what's not of this form and coming from an empty or external referrer shall go to the main domain and without the variables:</p>
  
  <p>maindomain.com/</p>
  
  <p>I tried with all kind of configuration, my last .htaccess file in the subdomain folder looks like this:</p>
  
  <pre><code>RewriteEngine on
  RewriteRule ^/?(\w{3})/(\w{3})/(\w{3})$ index.php?a=$1&amp;b=$2&amp;c=$3 [S=1,L]
  
  RewriteCond %{HTTP_REFERER} !^http://(www\.)?maindomain\.com [NC]
  RewriteRule ^(.*)$ http://domain\.com/ [L]
  </code></pre>
  
  <p>But it's still not doing what I want, it redirects also request for subdomain of the allowed form to the main domain and it also adds the vars as request to the main domain, going to this page </p>
  
  <blockquote>
    <p>maindomain.com/?a=aaa&amp;b=bbb&amp;c=cee</p>
  </blockquote>
  
  <p>Can you help me with the condition defined above.</p>
  
  <p>And a second question, about the performance: I could obviously do this verification / redirect with PHP, what would be more efficient in your opinion?</p>
  
  <p>Thank you!</p>