March 14, 2018
Comes in handy if you have items saved in a Plugin’s additional folders that you’d like to only be accessible to your paid / subscribed users.
The below example shows the plugin directory wpfb-file.
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_URI} ^.*wpfb-file/.* RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC] RewriteRule . /index.php?redirect_to=%{REQUEST_URI} [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Sourced here.