我需要为我的 .htaccess 文件编写一个防盗链命令,但它不能特定于任何域名。到目前为止,这是我在其他网站上发现的,但我不确定为什么它不起作用,有人能发现问题吗?
# Stop hotlinking.
#------------------------------
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^https?://([^/]+)/ [NC]
# Note the # is just used as a boundary. It could be any character that isn't used in domain-names.
RewriteCond %1#%{HTTP_HOST} !^(.+)#\1$
RewriteRule \.(bmp|gif|jpe?g|png|swf)$ - [F,L,NC]