Totally Zenned
- Join Date:
- Nov 2007
- Location:
- Woodbine, Georgia, United States
- Posts:
- 4,293
- Plugin Contributions:
- 39
Bots with Fake carts
Zen 2.1.0-2.2.2 PHP 8.3/8.5
Bootstrap
I am working of eliminating those dang bots with active carts with nothing in them. They access, first load urls like
index.php?main_page=shopping_cart&disp_order=8&manufacturers_id=8&page=6&products_id=230
This triggers active cart, but no contents. This parameter pollution or URL permutation crawling sucks up resources when you have 100 or so of these fake IP bots with active carts.
I am testing
if (
isset($_SESSION['cart'])
&& (int)$_SESSION['cart']->count_contents() < 1
) {
header('Location: /', true, 302);
exit;
}
in /includes/modules/pages/shopping_cart/header_php.php just after the opening page tag.
This appears to be a possible solution & I am currently live testing it.
I initially tried
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)main_page=shopping_cart(&|$) [NC]
RewriteCond %{HTTP_REFERER} !^https://(www\.)?your-domain\.com/ [NC]
RewriteRule ^index\.php$ /index.php [R=302,L]
</IfModule>
However, .htaccess can't tell somebody actually added an product to the cart. It only sees the HTTP request. The Referer header can also be missing, limited, or faked. So, the rule might redirect a real shopper who opens the cart in a new tab (like me) or uses privacy software.
Any thoughts?
~Melanie
PRO-Webs, Inc. since 2003 https://pro-webs.net/