【问题标题】:htacess hotlinking questionhtaccess 盗链问题
【发布时间】:2010-08-14 05:23:15
【问题描述】:

我的 htaccess 有这个代码

#
# Apache/PHP settings:
#

Options -Indexes
Options +FollowSymLinks

**# NOT WORKING #
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yourwebdomain.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?friend1domain.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?friend2domain.com(/)?.*$ [NC]
# NOT WORKING #**

# Set the default handler.
DirectoryIndex index.php

# PHP5, Apache 1 and 2
<IfModule mod_php5.c>
    php_value magic_quotes_gpc          0
    php_value register_globals          0
   php_value session.auto_start     0
   php_value memory_limit               128M
   php_value output_buffering           4096
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine on
  # Modify the RewriteBase if you are using zina in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /zina

  # Rewrite current-style URLs of the form 'index.php?p=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
</IfModule>

如何防止我的 mp3 和 jpg 文件从其他网站盗链?

我的mp3下载地址以http://www.domain.com/music/cat_one/band_name/file_mp3_name.mp3?l=12结尾

【问题讨论】:

    标签: .htaccess


    【解决方案1】:

    您可以将指向 mp3 和 jpg 文件的链接封装在 javscript 函数中。这样,您在 html 中没有链接,但用户操作(喜欢单击某个元素)将触发 javascript,然后通过即 ajax 加载 mp3 或 jpg。

    这将阻止大多数盗链,因为其他网站必须模仿用户(这并非不可能,但通常可能不值得努力)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-15
      • 2019-06-13
      • 1970-01-01
      • 1970-01-01
      • 2023-01-03
      • 1970-01-01
      • 2010-11-17
      • 1970-01-01
      相关资源
      最近更新 更多