Author: Stoker
Description: Here is a little addon for Your phpBB3 board that prevents hotlinking.
It only affects files that are uploaded with the "Upload attachment" function.
Uploaded Avatars, files and images are included.
This way it only causes very little server load because it only checks files placed in the download folder.
Note! Only works on servers running Apache!
Attached file: Demo: Copy and post this links at Your own site:
Code: Select all
http://www.phpbb3bbcodes.com/download/file.php?id=213
http://www.phpbb3bbcodes.com/download/file.php?id=162&mode=view/stats.png
Download the zip file, unzip it and open root/download/.htaccess file
It looks like this:
Code: Select all
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?yourdomain.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(php)$ ../stop.gif [L]
Example:
Code: Select all
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?phpbb3bbcodes.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(php)$ ../stop.gif [L]
Upload root/stop.gif to root
Offcourse You can use any other pic at Your own choice.
FAQ:
Q - What if I want to allow more domains to hotlink?
A - It is easily done. Lets say that phpbb.com should be allowed to hotlink, just use this:
Code: Select all
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?phpbb3bbcodes.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+.)?phpbb.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(php)$ ../stop.gif [L]