I am trying to obtain a RewriteCond/RewriteRule pair working, which leads to a 404 error unless of course I uncomment the RewriteCond, by which situation things are rerouted.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /path/
RewriteCond /var/www/site/downloads/$1 -F
RewriteRule ^(.+)$ getdownload.php [L]
</IfModule>

The concept is, when the file is available within the downloads directory to transmit the consumer towards the getdownload.php script, which distributes the download, presuming they've permission.

Any ideas why this is failing?

RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule path/downloads/(.*) path/downloads/getdownload.php? [L]

Still shows downloads/index.php in URL, but serves /downloads/getdownload.php content, AND ensures it is a file. (note: my .htaccess file is incorporated in the top degree of my test site.)

If you wish to place it into /downloads/ you are able to remove "path/downloads/" from each side from the rule.