My site uses PHPBB as a forum, and we would like to use it as a place to store and share large files up to 1gb.

I'm afraid that if one of our hotlinks is overly shared, it will cause problems with overly high usage of bandwidth and resources.

For example the page: http://forums.pcgamingwiki.com/viewtopic.php?f=23&t=60 contains the hotlink: http://forums.pcgamingwiki.com/download/file.php?id=4

What is a good way to prevent hotlinking in PHPBB? Can I get the hotlink to redirect to the forum post so that viewers will see our advertising, which will help pay for bandwidth? Is it possible to restrict files to be downloaded by logged in users only?

  • 1
    Restricting files to be downloaded by members only is certainly possible. However, this is a coding question and should fit better at stackoverflow.com – Christine Cooper Jan 27 '13 at 18:36
  • Thanks - I have been told that you can restrict to members-only quite easily be using the group permissions system in PHPBB to restrict anonymous users. – Andytizer Jan 28 '13 at 13:36
  • @ChristineCooper this doesn't belong on StackOverflow since it can be done through phpbb settings, see my answer below. – Anagio Feb 21 '13 at 12:08

Another method is to setup attachments to only br downloaded by members

ACP, Permissions tab, Groups forum permissions, Guests group, all forums, Advanced permissions, Content tab, Can download files, No.



The best and most flexible way to do this, if possible, is to use a .htaccess in your site root. Then you can redirect them to a script which either forces them to view ads, or just refuses to let them download the file.

Be warned that using an .htaccess isn't a foolproof method as things like referrer can be spoofed, but it should prevent any mass leeching.

  • Thanks this is great- is it possible for this script to force users to watch an ad page and then redirect them to the correct link? Or would it be a static page that it refers to. – Andytizer Jan 28 '13 at 13:39
  • The best way to do this is to have the .htaccess redirect them to a php script which forces them to watch an advertisement or such before serving the file. Clever users can still get past it, but it should catch the majority of users. – Kyros Jan 31 '13 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.