htaccess阻止直接访问文件

时间:2013-12-26 10:52:36

标签: apache .htaccess mod-rewrite webserver

我想阻止直接访问mp3文件,我正在使用此代码:

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

取自this answer:

当我从任何移动设备加载我的网站时,它正是我需要的工作,但mp3文件无法播放。

有什么想法吗?

谢谢!

0 个答案:

没有答案
相关问题