前提Apache中的mod_rewrite模块为激活状态,既然要消灭掉mp3文件的盗链就顺便也把图片盗链的设置给做了,下面是我在网站根目录的.htaccess文件中的配置,供同病相怜之人参考:。
view plaincopy to clipboardprint?<ifmodule mod_rewrite.c> #开启mod_rewrite引擎 RewriteEngine On #设置合法请求源
- <ifmodule mod_rewrite.c>
- #开启mod_rewrite引擎
- RewriteEngine On
- #设置合法请求源
- RewriteCond %{HTTP_REFERER} !^$ [NC]
- RewriteCond %{HTTP_REFERER} !zhangzhang.net [NC]
- RewriteCond %{HTTP_REFERER} !google.com [NC]
- RewriteCond %{HTTP_REFERER} !baidu.com [NC]
- RewriteCond %{HTTP_REFERER} !yahoo.com [NC]
- RewriteCond %{HTTP_REFERER} !msn.com [NC]
- RewriteCond %{HTTP_REFERER} !bloglines.com [NC]
- RewriteCond %{HTTP_REFERER} !feedburner.com [NC]
- RewriteCond %{HTTP_REFERER} !feedsky.com [NC]
- #指向警告页面
- RewriteRule .*\.(gif|jpg|png|mp3)$ outlink.gif [L,NC]
- </ifmodule>
您可能感兴趣的文章:
- 开启Apache mod_rewrite模块示例代码
- 13个实用的Apache Rewrite重写规则
- Apache伪静态Rewrite详解
- 如何在Ubuntu下启动Apache的Rewrite功能
- 浅析Apache中RewriteCond规则参数的详细介绍
- 浅谈apache和nginx的rewrite的区别
- Apache Rewrite实现URL的301跳转和域名跳转
- apache中通过mod_rewrite实现伪静态页面的方法
- Linux下Apache安装/增加mod_rewrite模块的方法
- Apache Rewrite url重定向功能的简单配置
- 让Apache支持Rewrite静态页面重写的方法
- Linux下Apache安装/增加mod_rewrite模块的方法
- apache urlrewrite防盗链功能配置
- 学习Apache的mod rewrite、access写法
- Apache rewrite的重写相关的参数说明
- Apache rewrite重写规则的常见应用
- apache rewrite_module模块使用教程
- apache的rewrite规则使用说明
本文由 华域联盟 原创撰写:华域联盟 » Apache中利用mod_rewrite实现防盗链
转载请保留出处和原文链接:https://www.cnhackhy.com/43214.htm