Performance and monitoring

Temporarily disable Gzip and Brotli from .htaccess

Reviewed on 2 min read gzip compresion

You can disable Gzip and Brotli on the server to investigate a specific incompatibility. Normally it is best to keep compression on: it reduces the data sent for HTML, CSS, JavaScript and other text formats.

Limit the change

Find the .htaccess file in the affected directory and save a copy outside the public root. If you change it in public_html, the rules may be inherited by other directories or domains hosted below it. Choose the smallest scope that lets you reproduce the fault.

Add this block, keeping the other rules:

<IfModule LiteSpeed>
    SetEnv no-gzip 1
    SetEnv no-brotli 1
</IfModule>

LiteSpeed supports these variables in .htaccess. The vendor's documentation describes Gzip and the no-brotli variable. You do not need to restart the server to change this file.

There are also rewrite rules that set these variables, but other rules can affect their outcome. Avoid adding several alternatives at once.

Check and restore

Open the browser's tools, go to Red / Network and request a text resource from the affected area again. Check the Content-Encoding header of a fresh response, not a copy served from the browser's cache.

If there is a CDN, it may keep compressing the response it delivers to the visitor. The hosting rule does not remove compression generated directly by the application either. Tell those layers apart before concluding that the change is not being applied.

Reproduce the original fault. When you finish, remove only the block you added, purge the affected cache if needed and check that compression works again. If a 500 error appears after editing, restore the copy of the file and check the error log.

You may also find useful

Something wrong or out of date? Tell us and we will review it.