Last active
September 27, 2024 18:23
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.