Hypertext Access file 防止热链接
例子
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC] RewriteRule \.(gif|jpg|css)$ - [F]
这将阻止所有来自域名的“.gif”,“。jpg”和“.css”文件链接http://www.yourdomain.com。
显示替代内容:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC] RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/angryman.jpg [R,L]
这将阻止所有不是来自域名“http://www.yourdomain.com/”的“.gif”和“.jpg”文件的链接,并显示文件“http://www.yourdomain.com/angryman”.jpg”。