How to prevent a file from direct URL Access?

后端 未结 7 2029
后悔当初
后悔当初 2020-11-22 05:26

I\'m using Apache and I have a sample web folder on my Local Host, like:

      http://localhost/test/

Files in th

7条回答
  •  感情败类
    2020-11-22 05:59

    Based on your comments looks like this is what you need:

    RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost/ [NC] 
    RewriteRule \.(jpe?g|gif|bmp|png)$ - [F,NC]
    

    I have tested it on my localhost and it seems to be working fine.

提交回复
热议问题