Hello,
on my Apache/2.4.25 (Debian) I'd like to forbid a direct download of files from two sub directories. Instead of the direct download I'd like to redirect to a "download.php" script to check if the user is logged in.
The URLs which I'd like to redirect are for example:
- domain.tdl/app/uploads/somefile.ext
- domain.tdl/app/downloads/somefile.ext
The target URLs should be:
domain.tdl/app/download.php?dir=uploads&file=somefile.ext
domain.tdl/app/download.php?dir=downloads&file=somefile.ext
Note that "somefile.ext" should be variable.
Now I am looking for a most simple "RewriteRule".
I'd like to avoid to create new groups for "<Directory /var/ww/app/upload>" and "<Directory /var/ww/app/download>" but create the rule under "<Directory /var/ww/app>" (if it's possible). Besides it would be nice if the rewrite would happen in background and the URL in the user's browser would always display the original URL.
Thanks for your help in advance