Created
June 15, 2018 13:05
-
-
Save Garconis/cca2347fcc5a122710375f4cee123a8b to your computer and use it in GitHub Desktop.
WordPress | Use htaccess to block logged-out users from certain folders or files
This file contains hidden or 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_COOKIE} !wordpress_logged_in [NC] | |
RewriteRule (^|/)uploads/private/.+?\.(.*)$ login/?redirect_to=/portal/ [R,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, this will only work on WP Engine, if you have them exclude the path from their caching system.