Skip to content

Instantly share code, notes, and snippets.

@nextab
Last active June 22, 2024 22:19
Show Gist options
  • Select an option

  • Save nextab/4c990cab94dadd340f2a880b98d67745 to your computer and use it in GitHub Desktop.

Select an option

Save nextab/4c990cab94dadd340f2a880b98d67745 to your computer and use it in GitHub Desktop.
This little snippet allows the system to have a php script (in the example edg-protected-file.php) handle a URL IF it's for a file (!) that's located under /wp-content/uploads/gesichert/
<IfModule mod_rewrite.c>
# Überprüfe, ob die Anfrage für eine Datei gilt.
RewriteCond %{REQUEST_FILENAME} -f
# Anstatt die Datei direkt per URL auszuliefern, übermittle die Anfrage an ein PHP-Skript, das die Validierung erledigt.
RewriteRule ^wp-content/uploads/gesichert/(.*)$ edg-protected-file.php?file=$1 [QSA,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment