I own a Linux-Apache site where I host exe files for download.
Now, when a user clicks this link to my site (published on another site):
http://mysite.com/downloads/file.exe
I need to dynamically check their user agent and redirect them to either
http://mysite.com/downloads/file-1.exe
or
http://mysite.com/downloads/file-2.exe
It seems to me that I have two options:
Put a .htaccess file stating that .exe files should be considered to be scripts. Then write a script that checks the user agent and redirects to a real exe placed in another folder. Call this script file.exe.
Use Apache mod-rewrite to point file.exe to redirect.php.
Which of these is better? Any other considerations? Thanks.
-
Is there a reason the link to the file has to be http://mysite.com/downloads/file.exe? It would be more straightforward if, instead of conditionally redirecting them at the web server level, your link was to http://mysite.com/downloads/get-file.php (or cgi, or jsp, whatever) instead. In other words, basically option one, but making the file link directly to the script rather than redirecting.
From Alex
0 comments:
Post a Comment