Skip to content

Instantly share code, notes, and snippets.

@jennimckinnon
Last active July 21, 2016 01:29
Show Gist options
  • Save jennimckinnon/cd5f4a3544000b53e32896dcbc3e1b09 to your computer and use it in GitHub Desktop.
Save jennimckinnon/cd5f4a3544000b53e32896dcbc3e1b09 to your computer and use it in GitHub Desktop.
hide your login page with code in WordPress. Replace "key=123". From WCEU 2016 talk by Maurizio Pelizzone: http://wordpress.tv/2016/07/01/maurizio-pelizzone-wordpress-hardening-ten-tips-in-ten-minutes/
# BEGIN Hide login page
RewriteRule ^mylogin$ wp-login.php?key=123&redirect_to=http://%{SERVER_NAME}/wp- admin/index.php [L]
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/wp-admin
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/wp-login.php
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/login
RewriteCond %{QUERY_STRING} !^key=123
RewriteCond %{QUERY_STRING} !^action=logout
RewriteCond %{QUERY_STRING} !^action=lostpassword
RewriteCond %{REQUEST_METHOD} !POST
RewriteRule ^wp-login.php http://%{SERVER_NAME}/? [R,L]
# END Hide login page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment