Block Logged-Out User Access to Directory Outside of WordPress using .htaccess and PHP file
I like your solution checking the coockie from the .htaccess this will give a much quicker loading solution then my solution. .htaccess <IfModule mod_rewrite.c> RewriteEngine On # Rules to prevent php execution in uploads RewriteRule ^(.*)/uploads/(.*).php(.?) – [F] #redirect all FILES for login check (excluding PHP) RewriteCond !^(.*)/uploads/([0-9]+/.*)\.php(.?)$ – [NC] RewriteRule ^(.*)/uploads/([0-9]+/.*)\.* /wordpress/file.php?img=$2 [L] </IfModule> … Read more