Created
May 8, 2023 15:14
-
-
Save danielcharrua/81f99499bcb816b40c6eba840f2c5142 to your computer and use it in GitHub Desktop.
Disable access to files inside WordPress upload sub-folder with cookie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file must be placed inside the directory eg. wp-content/uploads/documents | |
# Will prevent direct access for anyone but a logged-in user with a valid wordpress_logged_in cookie | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} ^.*(mp3|m4a|jpeg|jpg|gif|png|bmp|pdf|doc|docx|ppt|pptx|)$ | |
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC] | |
RewriteRule . - [R=403,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment