Apache Download: Make sure that page was viewed before download

Question :

Apache Download: Make sure that page was viewed before download,

Answer :

The job at hand:

I want to make sure that my website’s users view a page before they start a download. If they have not looked at the page but try to hotlink to the files directly they should go to the webpage before the download is allowed.

Any suggestions that are better than my idea to send out a cookie and – before the download starts – check if the cookie exists (via .htaccess)?

Read More  What do you think will be the level of usage of Silverlight 1 year from now?

The webpage and the download files will be located on different servers.


  • Apache 2 on all machines
  • PHP 5 on all machines
  • MySQL 5 available on the “webpage” server (no access from the download servers)

Nathan asked what the problem is that I try to solve, and in fact it is that I want to prevent hotlinks from – for example – forums. If people download from our server, using our bandwidth, I want to show them an page with an ad before the download starts. It doesn’t need to be totally secure, but we need to make some money to finance the servers, right? 🙂

Read More  Best implementation for Key Value Pair Data Structure?


Instead of allowing hotlinking to the files, store them outside of a web accessible route. Instead make download requests go to a php script that initiates the download. You can put checks in place to ensure that the requesting page was the one you wanted read.

That’s the answer Apache Download: Make sure that page was viewed before download, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Read More  Getting DIV id based on x & y position

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you