Overview

With WooCommerce being one of the most popular eCommerce systems used, it comes with a lot of power and a lot of flexibility. However, as it’s not a lightweight addon for WordPress, it can consume increased resources and cause your site to slow down if not managed well.

We recommend using a page cache (such as W3 Total Cache) to ensure users browsing your site have the fastest experience possible. However, pages with dynamic URL’s (eg, ?name=value) will bypass this cache as it’s expected the content should vary and therefore not be cached.

WooCommerce has a number of dynamic URL’s which can be used by plugins and themes for functions such as adding a product to the shopping cart (eg?add-to-cart=1234) to rapidly allow for product purchasing. Even though this is normally set with a rel=nofollow to tell bots and crawlers not to load the link, most of these bots still ignore this.

This can mean thousands of uncacheable URL’s for your website being crawled each day and potentially causing your website to be slow for normal customers or simply not accessible at all.

To fix this, you can take the following two steps:

1. Disallow via robots.txt

The first step is to explicitly tell the bots not to crawl URL’s with the add-to-cart in it. We can do this by adding the following line into your robots.txt file:

Disallow: *?add-to-cart=*

If you’re using an SEO plugin such as Yoast, Rank Math or similar then they will have an area to add this line in. Here’s a link for how to do it:

2. Block via .htaccess

Because not all bots actually use the instructions in the robots.txt, it may be necessary to explicitly block these bots at at web server level. You can add the following to your .htaccess file to block:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (Bot|Crawler|Spider) [NC]
RewriteCond %{QUERY_STRING} add-to-cart [NC]
RewriteRule .* - [F,L]

This will return a 403 to any request from a bot or crawler (eg, Googlebot) and not cause any impact on the performance of your website. Because these URL’s aren’t helpful to be indexed, it won’t have any impact on your SEO either.

If you’re still not sure what to do, please feel free to contact the Conetix support team and we can review your site (if hosted with us) on your behalf to recommend changes.

Was this article helpful?

Related Articles