Preventing image hotlinking

เราสามารถป้องกันไม่ให้โดนขโมยใช้แบนด์วิทโดยใช้ Rewrite  โดยเพิ่มข้อความต่อไปนี้ที่ไฟล์ .htaccess
ตัวอย่างนี้ป้องกันไม่ให้เว็บ test.com และ kapeek.com มา hotlink รูปภาพจากเรา 

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+.)?test.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+.)?kapeek.com/ [NC]
RewriteRule .*.(jpe?g|gif|bmp|png)$ - [F]
ที่มา: 

Leave a Reply

Your email address will not be published. Required fields are marked *