After my last post about fighting bots, I received several questions asking whether my solution would also work for simple web hosting setups. Unfortunately, that’s not the case. Even though most hosters use Apache and allow the use of mod_rewrite, they typically only permit configuration through .htaccess files. The problem is that the RewriteMap configuration my solution relies on cannot be defined there.
So I started thinking: what if we use PHP instead?
Ideally, we wouldn’t want bots to reach the PHP interpreter at all. But if we have no other choice, we can still make this fairly efficient by blocking bots very early—before the DokuWiki core is even initialized.
This is where the new Bot Check plugin comes in.
The idea is simple: the plugin generates a small, dependency-free PHP script that implements the bot checks. This script is then loaded via DokuWiki’s inc/preload.php mechanism, ensuring it runs as early as possible in the request lifecycle.
For end users, the experience is the same as for my previous solution. A quick button click sets a cookie and let's them access your wiki for 30 days.