title: htaccess rewrite rule for specific ajax url
body: <p>I am using </p>
  
  <pre><code>RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
  RewriteRule ^wp-admin/admin-ajax.php(.*)$ dl-file.php?file=$1 [QSA,L]
  </code></pre>
  
  <p>to protect worpdress files which are called with admin-ajax.php from not logged in users. But this breaks ajax for all visitors - so some things won't work for non registered users.</p>
  
  <p>How could I instead just specify a rewriterule for a specific url, for instance this one:</p>
  
  <pre><code>RewriteRule ^wp-admin/admin-ajax.php?action=ajax_request&amp;fn=download&amp;id=(.*) [QSA,L]
  </code></pre>
  
  <p>id would be a number for a file. 
  is there a way to do this with htaccess?</p>
  
  <p>I followed user hakre <a href="https://wordpress.stackexchange.com/questions/37144/how-to-protect-uploads-if-user-is-not-logged-in">https://wordpress.stackexchange.com/questions/37144/how-to-protect-uploads-if-user-is-not-logged-in</a> using dl-file.php</p>
  
  <p>Thank you!</p>
  
  <p>AD</p>