Protect “uploads” directory – Only accesible by logged in users
-
Hi. I have two wp installations:
/ -> public website
/private/ -> private website, only accesible by logged in usersI want to protect the /private/wp-content/uploads/ directory and it’s subdirectories. It should be only accesible by logges in users.
Actually, people can access to next file: https://www.mydomain.com/private/wp-content/uploads/2019/03/my-file.pdf
I desire that users not logged in, when try access above file, they are redirect to https://www.mydomain.com/private/wp-login.php
I am trying to do it modifing .htaccess file in /private/ directory. However, I have another .htaccess file in / (root) directory. I am following this steps: https://wordpress.stackexchange.com/a/37743
However, any modification is ignored. A not logged id user can see the PDF file. Could you help me, please?
—-
I have try next options:
RewriteCond %{REQUEST_URI} ^.*private/wp-content/uploads/.* RewriteRule ^private/wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L]
and
RewriteCond %{REQUEST_URI} ^.*wp-content/uploads/.* RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L]
and
RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^private/wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L]
and another combinations.
Please, help me.
- The topic ‘Protect “uploads” directory – Only accesible by logged in users’ is closed to new replies.