Skip to content

Instantly share code, notes, and snippets.

@riyas-rawther
Created September 17, 2022 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save riyas-rawther/38968571e6e6606e4991ba32d0dc725f to your computer and use it in GitHub Desktop.
Save riyas-rawther/38968571e6e6606e4991ba32d0dc725f to your computer and use it in GitHub Desktop.
NGINX code block to redirect to WordPress login page, when the user is not login.
//add this file to your site's configuration. It usually located inside the sites-enabled folder.
location ~ ^/wp-content/uploads/(?<file>restricted/.*)
{
rewrite ^ /dl.php?file=$file last;
// get the dl.php from https://www.youtube.com/shorts/GLiDRC9dbPg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment