ae4fadd3 by Jeff Balicki

lock down files

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 9c352c62
...@@ -18,4 +18,24 @@ RewriteCond %{REQUEST_FILENAME} !-d ...@@ -18,4 +18,24 @@ RewriteCond %{REQUEST_FILENAME} !-d
18 RewriteRule . /index.php [L] 18 RewriteRule . /index.php [L]
19 </IfModule> 19 </IfModule>
20 20
21 # END WordPress
...\ No newline at end of file ...\ No newline at end of file
21 # END WordPress
22
23
24
25 # require login for media files
26 # more info: https://m0n.co/11
27 <IfModule mod_rewrite.c>
28
29 RewriteCond %{REQUEST_URI} (\.pdf|\.docx|\.xlsx|\.ppt)$ [NC]
30
31 RewriteCond %{HTTP_COOKIE} !stc_logged_in [NC]
32
33 RewriteRule (.*) https://stellervistaconnect.com/
34 </IfModule>
35
36
37
38 # END WordPress
39
40
41 Options -Indexes
......
...@@ -268,3 +268,15 @@ function wpa_91930() { ...@@ -268,3 +268,15 @@ function wpa_91930() {
268 268
269 add_action( 'init', 'wpa_91930' ); 269 add_action( 'init', 'wpa_91930' );
270 270
271
272
273 add_action( 'wp_login', 'add_custom_cookie' );
274 function add_custom_cookie() {
275 setcookie( 'stc_logged_in',rand(5, 15), time()+WEEK_IN_SECONDS );
276 }
277
278 // To Remove Cookie
279 add_action( 'wp_logout', 'remove_custom_cookie' );
280 function remove_custom_cookie() {
281 setcookie( 'stc_logged_in', '', -1000000 );
282 }
...\ No newline at end of file ...\ No newline at end of file
......