Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bhwebworks/80c3d6ce06bba53bfa0ef700c2e01bb4 to your computer and use it in GitHub Desktop.
Save bhwebworks/80c3d6ce06bba53bfa0ef700c2e01bb4 to your computer and use it in GitHub Desktop.
Add this to .htaccess to block access to the WordPress default registration form unless referred from a specific page
#Block spam registrations (wp-login.php?action=register)
# Why? Server overloads and bounced emails
RewriteEngine On
#RewriteCond %{HTTP_REFERER} !^https://settigang.com/portal-access/?ld_register_id=580.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://settigang.com/portal-access/.*$ [NC]
RewriteCond %{THE_REQUEST} ^.*(wp-login.php\?action=register).* [NC]
RewriteRule ^(.*)$ - [F,L]
@bhwebworks
Copy link
Author

I've commented out the first HTTP_REFERER but left it there as an FYI. When I tried this with the ?ld_register_id=580 parameter appended to the referer URL it didn't work. Removing that parameter does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment