Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Redirects without rewriting the URL

AuthorDaveJarvis <email>
Date2023-11-08 22:30:00 GMT-0800
Commita8611314b4695133986232bf45e3a49bd6193528
Parent1b6d30c
Delta8 lines added, 4 lines removed, 4-line increase
www/downloads/.htaccess
RewriteEngine On
-RewriteCond %{REQUEST_URI} !^.*\.(test)$ [NC]
-RewriteRule ^(.+)$ download.php?filename=$1 [L,QSA]
-#RedirectMatch 302 \.(test)$ download.php?filename=$0
-#RedirectMatch 302 \.(zip|app|bin|exe|jar)$ ./download.php?filename=$0
+# Exclude existing files and directories from the rewrite rule.
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+
+# Rewrite requests for valid file extensions.
+#RewriteRule ^(.+\.(zip|app|bin|exe|jar))$ /downloads/download.php?filename=$1 [L]
+
+RewriteRule ^(.+\.(zip|app|bin|exe|jar))$ download.php?filename=$1 [L]