Skip to content
Aback Tools Logo

Apache mod_deflate Config Generator

Generate a ready-to-paste Apache mod_deflate GZIP compression configuration for .htaccess, httpd.conf, or VirtualHost blocks. The apache mod_deflate config generator lets you configure compression level, MIME types, browser exclusions, and Vary header settings — and produces a correct, production-ready configuration instantly. All generation runs in your browser — no signup required.

Apache mod_deflate Config Generator
Configure the options below to generate a ready-to-paste Apache mod_deflate GZIP compression configuration. The apache mod_deflate config generator supports .htaccess, httpd.conf, and VirtualHost placement — with recommended MIME types, browser exclusions, and Vary header settings. All generation happens in your browser — no signup required.

Place in your document root .htaccess — no server restart needed.

1 (fastest)Default — recommended for most sites9 (smallest)

Additional MIME Types

Additional Options

Advanced Tuning (optional)

Default: 8096

Default: 15 (max)

Generated Apache Config

# ── Apache mod_deflate GZIP Compression ──────────────────────────────────
# Place in your .htaccess file (document root or subdirectory)

<IfModule mod_deflate.c>

    # Enable GZIP compression for the following MIME types
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/json
    AddOutputFilterByType DEFLATE application/ld+json
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom+xml
    AddOutputFilterByType DEFLATE image/svg+xml

    # Compression level (1=fastest, 9=smallest; 6 is the recommended default)
    DeflateCompressionLevel 6

    # Add Vary: Accept-Encoding so CDNs cache compressed and uncompressed separately
    <IfModule mod_headers.c>
        Header append Vary Accept-Encoding
    </IfModule>

    # Disable GZIP for known broken browsers
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress already-compressed file types
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|webp|avif|zip|gz|bz2|rar|7z|mp3|mp4|mov|avi|mkv|pdf|woff2)$ no-gzip dont-vary

</IfModule>

Prerequisite: mod_deflate must be enabled on your server. On cPanel/shared hosting it is usually enabled by default. On Ubuntu/Debian: sudo a2enmod deflate headers && sudo systemctl reload apache2

File placement

/var/www/html/.htaccess   ← document root
/var/www/html/app/.htaccess ← subdirectory

Verify GZIP is working

curl -H "Accept-Encoding: gzip" -I https://example.com/
# Look for: Content-Encoding: gzip

Why Use Our Apache mod_deflate Config Generator?

Instant Apache mod_deflate Configuration

Configure compression level, MIME types, browser exclusions, and Vary header settings — the apache mod_deflate config generator produces a ready-to-paste configuration for .htaccess, httpd.conf, or VirtualHost blocks instantly.

Secure Apache mod_deflate Config Generator Online

All configuration generation happens entirely in your browser. No server details, domain names, or configuration data are sent to any server — safe for generating configs for internal, staging, or production Apache servers.

Three Placement Modes

The apache mod_deflate config generator supports .htaccess (no restart needed), httpd.conf (Directory/Location blocks), and VirtualHost placement — with contextual placement guides and prerequisite notes for each mode.

100% Free Forever

The apache mod_deflate config generator is completely free with no signup, no premium tier, no limits, and no ads. Generate unlimited Apache GZIP configurations at zero cost, forever.

Common Use Cases for Apache mod_deflate Config Generator

Shared Hosting GZIP Setup

Enable GZIP compression on shared hosting plans via .htaccess — the apache mod_deflate config generator produces a configuration that works without server restart or root access.

VPS and Dedicated Server Configuration

Generate a production-ready mod_deflate configuration for VPS or dedicated Apache servers — includes browser exclusions, Vary headers, and skip-already-compressed rules for correct behavior.

CDN Origin Server Optimization

Configure Apache to send correctly compressed responses with Vary: Accept-Encoding headers — ensures CDNs like Cloudflare and CloudFront cache compressed and uncompressed versions separately.

WordPress and PHP Application Hosting

Add GZIP compression to WordPress, Laravel, or Drupal sites running on Apache — the apache mod_deflate config generator includes JSON and XML MIME types for REST API response compression.

E-Commerce Site Performance

Reduce page weight for WooCommerce or Magento stores on Apache — GZIP compression typically reduces HTML, CSS, and JS transfer sizes by 70–85%, directly improving Core Web Vitals scores.

cPanel and Plesk Hosting Panels

Generate a .htaccess-based mod_deflate configuration compatible with cPanel and Plesk managed hosting — no SSH access required, just paste into the .htaccess editor.

Understanding Apache mod_deflate Configuration

What is Apache mod_deflate?

Apache mod_deflate is an Apache HTTP Server module that compresses HTTP responses using GZIP (DEFLATE algorithm) before sending them to the client. When a browser sends an Accept-Encoding: gzip request header, Apache compresses the response body — typically reducing HTML, CSS, and JavaScript transfer sizes by 70–85%. Our free apache mod_deflate config generator produces a ready-to-paste configuration with the correct AddOutputFilterByType,DeflateCompressionLevel, browser exclusions, and Vary header settings.

How Our Apache mod_deflate Config Generator Works

  1. Choose Your Options: Select the config placement (.htaccess, httpd.conf, or VirtualHost), compression level, MIME types to compress, and additional options like browser exclusions and Vary headers.
  2. Instant Browser-Based Generation: The apache mod_deflate config generator builds the configuration in real time as you adjust options — no server round-trips, no signup required.
  3. Copy and Deploy:Click "Copy" to copy the generated configuration, then paste it into your .htaccess file or Apache config. Use the verification command to confirm GZIP is working.

What Gets Configured

  • AddOutputFilterByType DEFLATE: Enables GZIP compression for specific MIME types — HTML, CSS, JS, JSON, XML, SVG, and optionally fonts and favicons.
  • DeflateCompressionLevel: Controls the CPU/size tradeoff — level 6 is the recommended default, balancing compression ratio and server CPU usage.
  • BrowserMatch exclusions: Disables GZIP for Mozilla/4 and old MSIE browsers with known broken GZIP support — prevents corrupted responses on legacy clients.
  • Vary: Accept-Encoding:Added via mod_headers — tells CDNs and proxies to cache compressed and uncompressed versions separately, preventing compressed responses from being served to clients that don't support GZIP.

mod_deflate vs mod_brotli — Which Should You Use?

mod_deflate (GZIP) has universal browser support and is the safe default for all Apache servers. mod_brotli provides 15–25% better compression than GZIP but requires Apache 2.4.26+ and is not supported by all clients. The recommended approach is to enable both — Apache will serve Brotli to clients that support it (via Accept-Encoding: br) and fall back to GZIP for all others. Use this apache mod_deflate config generator for the GZIP layer, and pair it with a mod_brotli configuration for modern clients.

Frequently Asked Questions About Apache mod_deflate Config Generator

An apache mod_deflate config generator produces a ready-to-paste Apache HTTP Server configuration that enables GZIP compression via mod_deflate. Our free online apache mod_deflate config generator runs entirely in your browser — configure compression level, MIME types, browser exclusions, and Vary headers, then copy the output directly into your .htaccess or httpd.conf.

Yes, complete privacy is guaranteed. The apache mod_deflate config generator runs entirely client-side in your browser — no configuration options, domain names, or server details are sent to any server. All generation happens locally on your device.

Yes. The apache mod_deflate config generator is 100% free with no signup, no subscription, no limits, and no ads. Generate unlimited Apache GZIP configurations at zero cost, forever.

On Ubuntu/Debian: run `sudo a2enmod deflate headers && sudo systemctl reload apache2`. On CentOS/RHEL: mod_deflate is usually compiled in — uncomment `LoadModule deflate_module modules/mod_deflate.so` in httpd.conf. On shared hosting (cPanel/Plesk): mod_deflate is typically enabled by default — just add the .htaccess configuration.

Level 6 is the recommended default for most sites — it provides a good balance between compression ratio and CPU usage. Use level 1–3 for high-traffic sites where CPU is a bottleneck. Use level 9 only for pre-compressed static assets where CPU cost is not a concern. The difference in output size between level 6 and level 9 is typically less than 5%.

The Vary: Accept-Encoding header tells CDNs and reverse proxies to cache compressed and uncompressed versions of each response separately. Without it, a CDN might cache the GZIP-compressed version and serve it to clients that don't support GZIP — causing corrupted responses. Always enable this header when using mod_deflate behind a CDN.

No. Raster images (JPEG, PNG, WebP, AVIF) and audio/video files are already compressed using their own codecs — applying GZIP on top adds almost nothing and wastes CPU. WOFF2 fonts are already Brotli-compressed internally. Only enable font compression for legacy TTF, OTF, and WOFF formats if you serve them.

.htaccess files are processed per-request and do not require a server restart — ideal for shared hosting where you don't have root access. httpd.conf (or a VirtualHost config) is processed at server startup and is more efficient for high-traffic sites since Apache doesn't need to read .htaccess files on every request. Use httpd.conf placement when you have server access.

Run: `curl -H "Accept-Encoding: gzip" -I https://example.com/` and look for `Content-Encoding: gzip` in the response headers. You can also use browser DevTools → Network tab → select a request → check the Response Headers for Content-Encoding: gzip.