When using Cloudflare there are some easy things you can do to help prevent abuse on your WordPress website. Malicious users use automated programs that query search engines like Google with specific search terms. For example, most WordPress websites use register.php to register new users. A simple search of “Buy clothes register.php” brings up a huge list of WordPress websites in the Clothing niche. Once a malicious user has a list of websites to target, they can use automated programs to create accounts on these WordPress sites. In this guide, we will learn how to use Cloudflare to stop automated registrations and Spam Comments when using WordPress.
WordPress Spam Comments
The process is exactly the same for spam comments on WordPress. Automated tools will post comments, usually with hyperlinks to point back to their website. The theory behind this is those links from your site will help them up the search engine rankings. That position would be somewhat true. However, the more spam comments on your website the less attractive it is to search engines. Eventually, this would harm your rankings and that would filter through to the sites in those spam comments too. So how do you stop abusive registrations on WordPress and abusive automated comment posting?
Cloudflare Firewall Rules
Since you are using Cloudflare you can block this abusive behaviour before it reaches your WordPress website. Cloudflare sites between the user and the server so it’s ideally positioned to handle this. There are other things you can use like Google Recapture. Unfortunately, if you are using a custom WordPress this option might not be available without modifications to the theme. Access Cloudflare and navigate to “Security > WAF“. Here is the Cloudflare firewall. You can add up to five rules on the free plan which is more than enough for this.
Create Cloudflare Firewall Rules
All WordPress websites use the same pages to post comments and register users. There is a limited scope that these pages could be changed if you use a custom theme but, for the most part, all WordPress websites are the same. So we need to add protection to the following pages.
We also need to protect against automated registrations so we can use a query string to apply a capture or challenge to any URL containing the word “register”. Add a new rule in Cloudflare WAF with the below rules. Copy them exactly and click “Save and Deploy”.
Monitor WordPress Website
Once your firewall rules are in place these should stop any automated signups. In Cloudflare, after some time you should start to see the number of automated signups and automated spam comments blocked. In this example, we added these firewall rules 8 hours ago. They have already blocked 49 attempts to register accounts and post spam comments.
This is a great way to protect any WordPress website against automated registrations and spam comments but the same logic can also be applied to other websites. You can configure Cloudflare to do the same on any login URL. For example, WHMCS uses dologin.php.
How was this article? How to use Cloudflare to stop WordPress spam comments and automated registrations
You might also like
More from Reseller Web Hosting
Host WebsitescPanel allows you to host websites by using a GUI or graphical user interface to manage your website. Used …
Enter your FTP credentialsThe enter your FTP credentials error manifests in a number of ways and can be caused by …