Optimized robots.txt for WooCommerce & WordPress

last updated 8 months ago

During an audit, it was found that a WooCommerce website was causing high CPU usage, which was due to frequent bot accesses to non-cachable pages with the parameter ?add_to_wishlist= These pages are indexed by bots such as Googlebot and Ahref, which slows down the website. To prevent this, it is recommended to /robots.txtfile that prevent bots from indexing these links. Regardless of whether the "add-to-cart" function is executed via JavaScript or directly in HTML, disabling indexing of such parameters is a necessary measure.

Optimized robots.txt

#Block WooCommerce assets User-agent: * Disallow: /cart/ Disallow: /shopping cart/ Disallow: /checkout/ Disallow: /kasse/ Disallow: /my-account/ Disallow: /my-account/ Disallow: /*?orderby=price Disallow: /*?orderby=rating Disallow: /*?orderby=date Disallow: /*?orderby=price-desc Disallow: /*?orderby=popularity Disallow: /*?filter Disallow: /*add-to-cart=* Disallow: /*?add_to_wishlist=* #Block Search assets User-agent: * Disallow: /search/ Disallow: *?s=* Disallow: *?p=* Disallow: *&p=* Disallow: *&preview=* Disallow: /search

With these parameters, crawlers will no longer index "add-to-cart" links and other non-cacheable pages. This results in CPU, memory, and bandwidth savings.

Conclusion

For hosting providers that base their pricing on CPU usage, this measure would significantly reduce monthly costs. Even with traditional web hosting, this would result in a noticeable reduction in CPU usage. Furthermore, these robots.txt settings allow you to save valuable crawl credits when using Ahrefs. Last but not least, the overall ranking by Google crawlers also benefits, as valuable crawl limits are saved and the Google crawler can focus on essential content.

Content

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    lk media – your partner for online marketing & web design.

    Your success online is what drives us.
    lkmedia white
    Agency for future-oriented online marketing and web design. We are a team of creative minds and strategic thinkers who are passionately committed to your success in the digital space. Our goal is to present your brand optimally, reach your target group and generate sustainable growth.
    © Copyright 2024 lkmedia
    Sitemap Data protection imprint
    en_USEnglish