Learn how to use LiteSpeed exclude JS to prevent JavaScript conflicts in WordPress. Our support team is always here to help you.
How to Properly Use Exclude JS to Avoid Conflicts in WordPress
If you’re using LiteSpeed on your WordPress site and running into issues with JavaScript file processing, especially when using plugins like Thrive Leads or Thrive Theme Builder, you’re not alone. One common issue is when LiteSpeed Cache minifies already minified JavaScript files, leading to broken features or layout issues.
In this guide, we’ll show you how to use LiteSpeed exclude JS functionality both at the server level and through the LiteSpeed Cache plugin in WordPress to avoid these conflicts. Let’s get straight into the solution.
An Overview
Server-Level Exclusion for JavaScript (Advanced Users)
If you’re running your own server and have root access, you can exclude JavaScript files from being processed by LiteSpeed directly via configuration files.
Steps:
Access Server Configuration Files
Navigate to your LiteSpeed configuration directory:
/usr/local/lsws/conf/
Copy Code
Locate the Virtual Host Configuration File
Each website has its own file under:
/usr/local/lsws/conf/vhosts/
Copy Code
Edit the Virtual Host Configuration File
Open the file with your preferred editor (like nano or vim).
Locate the <IfModule LiteSpeed> Section
Within the file, find this section.
Add the Following Exclusion Directive:
IfModule LiteSpeed>
...
SetEnv noabort 1
SetEnv noconntimeout 1
RewriteEngine On
RewriteCond %{REQUEST_URI} \.js$ [NC]
RewriteRule .* - [L]
...
Copy Code
This tells LiteSpeed to skip processing for any .js files, improving compatibility and performance.
Save and Restart LiteSpeed
Run:
sudo /usr/local/lsws/bin/lswsctrl restart
Copy Code
WordPress-Friendly Way: Using LiteSpeed Cache Plugin
For most WordPress users, the easier and safer method is to handle exclusions within the LiteSpeed Cache plugin settings.
Steps:
- Go to LiteSpeed Cache → Page Optimization
From your WordPress admin sidebar, hover over LiteSpeed Cache and select Page Optimization.
- Open the Tuning Tab
Navigate to the “Tuning” tab in the Page Optimization screen.
- Add Exclusions
In the “CSS Excludes” and “JS Excludes” fields, paste the following:
CSS Excludes:
/wp-content/plugins/thrive-leads/editor-layouts/css/(.*).css
/wp-content/plugins/thrive-visual-editor/(.*).css
/wp-content/themes/thrive-theme/style.css/(.*).css
Copy Code
JavaScript Excludes:
/wp-content/plugins/thrive-leads/js/(.*).js
/wp-content/plugins/thrive-visual-editor/(.*).js
/wp-content/themes/thrive-theme/thrive-dashboard/(.*).js
/wp-content/themes/thrive-theme/inc/(.*).js
Copy Code
Save Changes
After pasting, click Save Changes at the bottom of the page.
By using these exclusions, you ensure that LiteSpeed Cache doesn’t interfere with critical JavaScript functionality, particularly with Thrive products.
[If needed, Our team is available 24/7 for additional assistance.]
Conclusion
Knowing when and how to use LiteSpeed exclude JS can save you hours of troubleshooting broken layouts and malfunctioning forms. If you’re managing your own server or using the LiteSpeed Cache plugin in WordPress, following these exact steps gives you complete control over how JavaScript files are handled.
0 Comments