Why This Matters
CompressX uses rewrite rules in Apache’s .htaccess to serve optimized WebP and AVIF images automatically. If Apache is not configured to allow .htaccess overrides, these rules will not be applied and optimized images may not be delivered correctly.
How to Configure Apache .htaccess for CompressX
Step 1: Connect to Your Server
Use an SSH client such as PuTTY, Terminal, or your hosting control panel’s SSH feature to connect to your server. This gives you direct access to your Apache configuration files.
Step 2: Open Your Apache Site Configuration
Once connected, navigate to your Apache configuration directory and open your site’s .conf file. Replace example.com with your actual domain name:
nano /etc/apache2/sites-available/example.com.conf
This file controls how Apache serves your specific site.
Step 3: Enable .htaccess Overrides
Find the <Directory> block that corresponds to your website’s root directory. It may look like this:
<Directory /var/www/>
Within this block, locate the following directive:
AllowOverride None
Change it to:
AllowOverride All
This change tells Apache to allow .htaccess files to override default settings, which is necessary for CompressX’s rewrite rules to work.

Step 4: Save Your Changes
After updating the directive:
- 1. Press Ctrl + X to exit the editor.
- 2. Press Y then Enter to save your changes.
Step 5: Restart Apache
Restart the Apache service to apply the new configuration:
service apache2 restart
Once restarted, Apache will now process .htaccess overrides, and CompressX’s rewrite rules should function correctly.
What Happens Next
With AllowOverride All enabled:
- 1. CompressX’s
.htaccessrules are allowed to execute. - 2. Optimized WebP and AVIF images can be served automatically based on browser support.
- 3. Rewrite errors due to disabled overrides are resolved.
1. Some hosting environments may not allow SSH access—check with your host if you cannot connect.
2. If you still experience rewrite errors after these steps, double-check your Apache version and modules (
mod_rewrite must be enabled).3. Always back up your configuration files before making changes.
Need Assistance?
If you continue to have trouble after applying these steps, feel free to contact us for help.


