Subscribe to our social networks

arrow icon All Post

How To Exclude Items From Being Cached by LiteSpeed Cache. A Step-by-Step Guide

Apr 02, 2024 | Author: Info Publytics

How To Exclude Items From Being Cached by LiteSpeed Cache. A Step-by-Step Guide

Here's a step-by-step guide on how to exclude items from being cached by LSCache

LiteSpeed Cache (LSCache) stands as an integral, high-performance dynamic content acceleration attribute within LiteSpeed server products.

This feature expedites dynamic content, encompassing more than just PHP pages, offering functionalities similar to Apache mod_cache. It employs an highly adaptable native implementation within LiteSpeed servers, effectively curtailing page load time and server strain.

Dynamic content refers to web content that changes frequently and is generated in real-time based on user interaction, preferences, or other variables. In the context of caching, dynamic content can include:

  • User-specific pages: Pages that display user-specific information, such as profile pages, dashboards, or personalized recommendations.
  • Interactive elements: Features like search results, forms, comment sections, and live chat widgets.
  • E-commerce components: Shopping carts, checkout pages, and product recommendations that vary from user to user.
  • Session-based content: Content that changes based on the user’s session state, like login status or items in a shopping cart.

Whether you’re looking to improve user experience, prevent dynamic content from being cached, or simply want more control over your site’s caching behavior, this guide will walk you through the process step-by-step.

1. Access Your WordPress Dashboard: 
Begin by logging into your WordPress site’s admin area.

2. Navigate to LiteSpeed Cache Settings: 
On the left-hand side menu, hover over “LiteSpeed Cache” and click on “Cache,” then select “Excludes.”

3. Exclude Specific URIs:
In the “Do Not Cache URIs” section, enter the URIs you wish to exclude. You can use regular expressions to match patterns if needed.

4. Exclude Query Strings: 
If there are specific query strings you want to exclude from caching, add them to the “Do Not Cache Query Strings” section.

5. Exclude Categories, Tags, or Taxonomies: 
Use the “Do Not Cache Categories,” “Do Not Cache Tags,” and “Do Not Cache Taxonomies” sections to exclude entire categories, tags, or other taxonomies from being cached.

6. Save Your Changes: 
After you’ve made your exclusions, be sure to click the “Save Changes” button to apply them.

7. Verify Exclusions: To ensure that your exclusions are working as intended, you can check the cache status of a page by appending ?LSCWP_CTRL=disable to the end of the URL and comparing the load times and/or using browser developer tools to inspect the headers.

To exclude a script from optimization, you can follow these steps:

1. In your WordPress admin section, go to LiteSpeed Cache > Page Optimization.

2. Select the Tuning tab where you can specify files to exclude from optimization.
2.1. For CSS: Enter the file URLs or keywords in the CSS Excludes box.
2.2. For JavaScript: Enter the file URLs or keywords in the JS Excludes box.

3. Click on 'Save Changes' button.

Posted: 3 months ago
Author: Info Publytics

Recent Posts

bg img

    Are you looking for a complete tool to measure your website's progresses? Get deep into Publytics with our 14 Days of free trial!

  • Try it for free