Only Allow Logged In User to Access WordPress Upload Files

How to protect the files within WordPress upload folder, only allow logged in user to access or download the files from WordPress upload folder

You can use .htaccess to pass all requests to a PHP script file. If user is not logged in, can redirect user to login page or print out the 404 information.

Insert new rules with .htaccess file

Pass are requests (To access the files within upload folder) to the proxy file to check if the user is logged in or not

Create a PHP file with the following codes

This PHP script will check if user is logging or not. If user is not logged in, user will be redirected to home page

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments