title: Use .htaccess to limit access based on referrer?
body: <p>I want to use .htaccess rules to beef up security for Wordpress my blog. Basically, I want to forbid the connection when:</p>
  
  <ul>
  <li>useragent is empty</li>
  <li>referrer string is empty</li>
  <li>referrer string to a few selected php files is NOT from my domain</li>
  </ul>
  
  <p>I've come up with the following code. Am I on the right track? If not, please suggest what I should do to fix it. Thank you!</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteCond %{HTTP_REFERER} ^$
      RewriteCond %{HTTP_USER_AGENT} ^$
      RewriteCond %{REQUEST_URI} wp-comments-post\.php* [NC]
      RewriteCond %{REQUEST_URI} wp-admin\.php* [NC]
      RewriteCond %{REQUEST_URI} wp-login\.php* [NC]
      RewriteCond %{HTTP_REFERER} !.*example.com.* [NC]
      RewriteRule . - [R=403,L]
  &lt;/IfModule&gt;
  </code></pre>