简体   繁体   中英

Prevent Direct Access to pdf file? php, wordpress

How can i prevent direct access to my pdf file in wp-content/upload/woocommerce_upload folder

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https://(www.)?domin.com/wp- 
content/uploads/woocommerce_uploads/2020/01/.*$ [NC]
RewriteRule \.(pdf|jpe?g|png)$ - [F]

Its not working please help

why not use this?


<FilesMatch "/wp- 
content/uploads/woocommerce_uploads/2020/01/.*\.pdf$">
   Order allow,deny
   Deny from all
</FilesMatch>

I think this should help: https://httpd.apache.org/docs/2.4/mod/core.html#files

it should be something like:

<Files "yourfilename.pdf">
Require all denied
</Files>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM