Forum Moderators: phranque
===============================================
download counter - dlcount.php
There's a download counter integrated in PowerPhlogger. In order to use it you just need to modify your links:
use this syntax, if yourfile.zip is located relative to your primary URL (the first URL you set in your
userprofile):
<a href="[path_to_pphlogger]/dlcount.php?id=[username]&url=/yourfile.zip">yourfile.zip</a>
If the file is located anywhere else, use an absolute path:
<a href="[path_to_pphlogger]/dlcount.php?id=[username]&url=http://www.somewhereelse.com/yourfile.zip">yourfile.zip</a>
=============================================
the problem is that i can't make use of it by editing the "href" part manually, cause i am using autoindex to layout files
so, i am thinking of using the rewrite fuction to do that but hours of reading doc and dealing with rules, i'm totally lost
any help will be appreciated
rewrite yourfile.zip to [path_to_pphlogger]/dlcount.php?id=[username]&url=/yourfile.zip:
RewriteRule ^yourfile\.zip$ /[path_to_pphlogger]/dlcount.php?id=[username]&url=/yourfile.zip [L]
The above is intended for use in .htaccess; For use in httpd.conf, add a leading slash to the RewriteRule pattern, i.e. ^/yourfile\.zip
See this Introduction to mod_rewrite [webmasterworld.com].
HTH,
Jim
anyway, start with one specific file is a good idea, but i still failed
as you suggested, i tried this:
RewriteRule ^/test/test\.zip$ /pphlogger/dlcount.php?id=redhat71&url=/test/test.zip [L]
127.0.0.1 - - [20/ 4月/2003:14:36:29 +0800] [redhat71.3322.org/sid#809ddb0][rid#823add0/initial] (3) [per-dir /var/www/html/] strip per-dir prefix: /var/www/html/test/test.zip -> test/test.zip
127.0.0.1 - - [20/ 4月/2003:14:36:29 +0800] [redhat71.3322.org/sid#809ddb0][rid#823add0/initial] (3) [per-dir /var/www/html/] applying pattern '^/test/test\.zip$' to uri 'test/test.zip'
127.0.0.1 - - [20/ 4月/2003:14:36:29 +0800] [redhat71.3322.org/sid#809ddb0][rid#823add0/initial] (1) [per-dir /var/www/html/] pass through /var/www/html/test/test.zip
why does the log say "pass through"? thanks
You only have to rename the real yourfile.zip itself. Do not change any links on other pages.
Alternatively, you could move the real yourfile.zip into it's own subdirectory, or change all the old links to it (ugh) to use a different filename/filepath.
The idea is that you must give mod_rewrite something to use to keep the linked-to URL and the final URL distinct, while inserting the script activity between them. This avoids the recursion problem.
HTTP is a stateless protocol and has no "memory," so unique filepaths are probably the easiest way to go.
HTH,
Jim