How to prevent a file from direct URL Access?

后端 未结 7 2036
后悔当初
后悔当初 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 06:02

    When I used it on my Webserver, can I only rename local host, like this:

    RewriteEngine on 
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com [NC] 
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com.*$ [NC] 
    RewriteRule \.(gif|jpg)$ - [F]
    

提交回复
热议问题