Skip to content

Instantly share code, notes, and snippets.

@nathanp
Created April 5, 2017 18:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanp/02a615fbc7e8bac6ca139c6c3bea38e7 to your computer and use it in GitHub Desktop.
Save nathanp/02a615fbc7e8bac6ca139c6c3bea38e7 to your computer and use it in GitHub Desktop.
Sample .htaccess configuration to use the dl-file.php from https://gist.github.com/nathanp/50e76eb23a3f084cce4205657ee71acc
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# BEGIN THIS DL-FILE.PHP ADDITION
RewriteCond %{REQUEST_URI} ^.*wp-content/uploads/membersonly/.*
RewriteRule ^wp-content/uploads/(membersonly/.*)$ dl-file.php?file=$1 [QSA,L]
# END THIS DL-FILE.PHP ADDITION
</IfModule>
# END WordPress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment