仅为php用户htaccess下载文件

how could i do this with htaccess , please ?

if (url has not parameter ?down=true) 
redirect back
else
do noting
end if

example

example.com/upload/file.pdf // it mustn't downlaod the file

example.com/upload/file.pdf?down=true // it must download the file

please help me :)

that's my htaccess file

RewriteEngine on
RewriteRule ^upload/file/(.*) http\:\/\/www\.example\.org\/down.php?file=$1 [L]

this is the down.php page

<?php
session_start();

if(isset($_SESSION["user_id"])){ 
if(isset($_GET["file"])) $file = mysql_escape_string($_GET["file"]);
$file = "http://www.example.org/upload/file/".$file;
$file = preg_replace("/ /", "%20", $file);

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
//header('Content-Length: ' . filesize($file));
readfile($file);
exit;

}else{
header('Location:login.php');
}
exit();

You need %{QUERY_STRING} variable inside a RewriteCond for that checking for redirect like this.

RewriteEngine On
RewriteCond %{QUERY_STRING} !(^|&)down=true($|&)
RewriteRule example\.com\/upload\/file\.pdf /index.php [L]

if your RewiteCond has a down=true in the query string, then do not apply the following rule,else rewrites all request to /index.php