Best way to track (direct) file downloads

前端 未结 3 1794
傲寒
傲寒 2021-01-31 23:21

what is the best method to track direct file downloads? I found some solution, for example this one:

http://www.gayadesign.com/diy/download-counter-in-php-using-htacces

3条回答
  •  醉话见心
    2021-01-31 23:59

    Feel free to use :)

    .htaccess:

    RewriteEngine on    
    RewriteRule ^(.*).(rar|zip|pdf)$ http://xy.com/downloads/download.php?file=$1.$2 [R,L]    
    

    mysql:

    CREATE TABLE `download` (
        `filename` varchar(255) NOT NULL,
        `stats` int(11) NOT NULL,
        PRIMARY KEY  (`filename`)
    )
    

    download.php

    
    

    Source - gayadesign.com

提交回复
热议问题