Created
February 16, 2018 17:44
-
-
Save Garconis/6be796b51994c79010cb0c3a3cfedd86 to your computer and use it in GitHub Desktop.
WordPress | NGINX server rule to block access to files in a folder unless logged into WP
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
set $bar 0; | |
set $becue 0; | |
if ( $request_uri ~* "wp-content/uploads/private" ) { | |
set $bar 1; | |
} | |
if ($http_cookie ~ "wordpress_logged_in") { | |
set $becue 1; | |
} | |
set $barbecue "$bar:$becue"; | |
if ($barbecue = "1:0") { | |
rewrite ^/(.*) https://www.example.com/login/; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment