.htaccess htaccess保护下载文件夹

.htaccess htaccess保护下载文件夹,.htaccess,.htaccess,我在下载目录下的htaccess文件中添加了以下几行- order Deny,Allow Deny from all 现在我想重写 https://example.com/download/myfile.pdf to https://example.com/get-file.php?directory=download&request=myfile.pdf 以下是我的htaccess文件在web根目录中- RewriteEngine On RewriteBase "/" Rewr

我在下载目录下的htaccess文件中添加了以下几行-

order Deny,Allow
Deny from all
现在我想重写

https://example.com/download/myfile.pdf 
to 
https://example.com/get-file.php?directory=download&request=myfile.pdf
以下是我的htaccess文件在web根目录中-

RewriteEngine On
RewriteBase "/"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L] 

RewriteRule    ^download/([A-Za-z0-9-.]*+)/?$    get-file.php?directory=download&request=$1   [NC,L]

ErrorDocument 404 /invalid-page-name

# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP
重新编写引擎打开
重写基“/”
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?页面=$1[L,QSA]
重写条件%{HTTPS}关闭
重写规则^(.*)$https://%{HTTP_HOST}/$1[R,L]
重写规则^download/([A-Za-z0-9-.]*+)/?$get file.php?目录=下载和请求=$1[NC,L]
错误文档404/无效的页面名称
#开始GZIP
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
#结束GZIP
这是行不通的。谁能告诉我哪里出了错?非常感谢您的帮助。

请尝试更改

order Deny,Allow
Deny from all


命令允许,拒绝
全盘否定
<FilesMatch ".*">
    Order Allow,Deny
    Deny from All
</FilesMatch>