我试图阻止访问我的网站取决于访问者是否通过另一个网站访问了该网站。 后者已经通过使用iframe来通过他的网站显示内容来使用我的stream量,掩盖了我的网站的身份。
我有mod_env_if在apache2中激活。
ErrorDocument 403 /error403.html SetEnv noaccess=0 SetEnvIf Referer "^http://sitetoblock\.tk/" noaccess=1 SetEnvIf Referer "^http://www\.sitetoblock\.tk/" noaccess=1 <FilesMatch "\.(gif|png|jpe?g|php|html)$"> Order Allow,Deny Deny from env=noaccess </FilesMatch>
问题是这个指令阻止了包括站点的直接访问者在内的所有stream量。 我究竟做错了什么?
在您的configuration中,默认访问状态是“拒绝”,因为您有“Order Allow,Deny”。 将订单更改为“拒绝,允许”,以便您可以根据您的引荐检查明确拒绝访问。
您需要在url中排除点,例如:
SetEnvIf Referer "^http://sitetoblock\.tk/" noaccess=1 SetEnvIf Referer "^http://www\.sitetoblock\.tk/" noaccess=1