..start..fly..

扫一扫
Guestbook

Home / PHP & Wordpress / 通过.htaccess防止wordpress图片文件盗链

<< 让弹窗下载查看插件支持文档查看wordpress中通过d13slideshow插件实现幻灯播放 >>

原文是英文,为:

The first thing to do is to create a small image saying something like “Please do not hotlink from my server”. and upload it on your blog server.
Then, we’ll have to edit the .htaccess file, located in your WordPress blog root directory. When modifying .htaccess, always create a backup.

The first thing to do is to create a small image saying something like “Please do not hotlink from my server”. and upload it on your blog server.Then, we’ll have to edit the .htaccess file, located in your WordPress blog root directory. When modifying .htaccess, always create a backup.

作者网址为:http://www.wprecipes.com/how-to-protect-your-wordpress-blog-from-hotlinking

翻译成中文以后,具体实现方法就是先下载网站目录下的.htaccess,用记事本打开后,添加以下这段代码:

  1. RewriteEngine On
  2. #Replace ?mysite\.com/ with your blog url
  3. RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
  4. RewriteCond %{HTTP_REFERER} !^$
  5. #Replace /images/nohotlink.jpg with your “don’t hotlink” image url
  6. RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]

替换mysite为自己的网址和/images/notlink.jpg为自己定制的防盗链声明图片,然后重新上传覆盖就可以了,这个方法很简单,却可以为你节约大量的流量,其中可以增加更多的格式,比如zip,rar等等。

Related Posts

转载原创文章请注明,转载自:SKY..fly..[www.sky.gs]

本文链接: https://www.sky.gs/websites/phpwordpress/nonlink.html

QR:  通过.htaccess防止wordpress图片文件盗链

3 Responses to “通过.htaccess防止wordpress图片文件盗链”

  1. 先做站一年。然后再使用防盗链

    • sky says:

      因为觉得很重要的各功能,所以留着了,而且有的时候服务器更新了会丢失原来添加的htaccess内容,利于重新补上,呵呵

Leave a Reply

Code (☆)9+2=?


Websites powered by Wordpress6.7.1 Copyright © 2009-2025 - All Rights Reserved   SKY..fly..