Redirect to download script

Alles, was den Apache betrifft, kann hier besprochen werden.

Redirect to download script

Postby rap123 » 17. December 2018 18:38


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:

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
Posts: 1
Joined: 17. December 2018 18:12
XAMPP version: N/A
Operating System: Linux

Return to Apache

Who is online

Users browsing this forum: No registered users and 4 guests