Skip to content

Instantly share code, notes, and snippets.

@jennimckinnon
Created August 4, 2016 17:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennimckinnon/e3cf9cacd310657035c903d22ef531a8 to your computer and use it in GitHub Desktop.
Save jennimckinnon/e3cf9cacd310657035c903d22ef531a8 to your computer and use it in GitHub Desktop.
Rename WordPress login page. Replace "key=123". Based on the code from the WCEU 2016 talk by Maurizio Pelizzone.
# BEGIN Hide login page
RewriteRule ^mylogin$ https://%{SERVER_NAME}/wp-login.php?key=123&redirect_to=https://%{SERVER_NAME}/wp-admin/index.php [L]
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/wp-admin
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/wp-login.php
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/login
RewriteCond %{QUERY_STRING} !^key=123
RewriteCond %{QUERY_STRING} !^action=logout
RewriteCond %{QUERY_STRING} !^action=lostpassword
RewriteCond %{REQUEST_METHOD} !POST
# END Hide login page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment