Updated: 12 November 2026 · Applies to: mod_pagespeed 1.13 on Apache 2.4 (tested on Debian 13), cPanel and WHM with EasyApache 4
To disable mod_pagespeed for one cPanel account, add these lines to the .htaccess file in the site's document root (usually public_html):
<IfModule pagespeed_module>
ModPagespeed off
</IfModule>
The change takes effect on the next request; there is nothing to restart. The <IfModule> wrapper means the lines are simply ignored on a server where the module is not loaded, so they can never cause an HTTP 500 error.
mod_pagespeed rewrote HTML, CSS, JavaScript and images on the fly to make pages load faster. The Apache Software Foundation retired the open source PageSpeed project on 17 March 2023, and the last release was years before that, so on a current site it more often causes trouble (broken layouts, stale CSS, odd caching) than it helps. For background and alternatives, see mod_pagespeed on cPanel EasyApache 4: Status and Better Alternatives.
Step 1: check whether mod_pagespeed is active on your site
When the module processes a page, Apache adds an X-Mod-Pagespeed response header. Check for it from any terminal (replace the domain with yours):
curl -sI https://example.com/ | grep -i pagespeed
Output when the module is active (from our test server):
X-Mod-Pagespeed: 1.13.35.2-0
No output means the module is not touching that page. You can also look for .pagespeed. in the file names of CSS, JavaScript and image links when you view the page source in your browser.
Step 2: turn it off in .htaccess (cPanel account)
- Log in to cPanel and open Files > File Manager.
- Click Settings (top right), tick Show Hidden Files (dotfiles) and save, so that
.htaccessis visible. - Open
public_html(or the document root of the addon domain or subdomain you want to change). If there is no.htaccessfile yet, create one with + File. - Right-click
.htaccess, choose Edit and add the three lines from the top of this article. Put them at the top of the file, above any rules added by WordPress or another application. - Click Save Changes in the editor.
- Run the
curlcheck from Step 1 again. TheX-Mod-Pagespeedheader should be gone.
The setting applies to that folder and every folder below it. To disable the module only for one part of the site, put the same lines in a .htaccess file inside that subfolder instead. If you are new to the file, see What Is .htaccess and How to Edit It in cPanel.
In our test, a page served with the module on had its stylesheet link replaced by an inline <style> block. With ModPagespeed off in .htaccess, the same page came back exactly as written, with no X-Mod-Pagespeed header.
Test without changing anything: the query parameter
To see whether mod_pagespeed is the cause of a problem before you edit any file, open the page with ?PageSpeed=off on the end of the address:
curl -sI "https://example.com/?PageSpeed=off" | grep -i pagespeed
In our test this returned the page unoptimised and without the header. If the page looks right in your browser with the parameter and broken without it, the module is the cause and the .htaccess fix above will solve it.
Disable it for the whole server (WHM, root access)
If you run your own VPS or dedicated server and no site needs mod_pagespeed, remove the module rather than switching it off site by site. According to cPanel's EasyApache 4 documentation:
- In WHM, open Software > EasyApache 4.
- Click Customize next to the currently installed profile.
- Go to Apache Modules, search for
pagespeedand switch the module off. - Click Next through to the Review section, check that the package is listed for removal, and click Provision.
The package name on cPanel servers is ea-apache24-mod_pagespeed. To check whether it is installed on an AlmaLinux or CloudLinux based cPanel server:
rpm -q ea-apache24-mod_pagespeed
On a plain Debian or Ubuntu server without cPanel, the module installs as pagespeed. Disable it and restart Apache:
a2dismod pagespeed
systemctl restart apache2
What to use instead
- A caching plugin or your application's own cache (for WordPress, see How to Leverage Browser Cache With .htaccess in WordPress?).
- Images resized and compressed before upload, in WebP or AVIF where your site supports it.
- A CDN in front of the site for static files.
If your site still looks wrong after mod_pagespeed is off, clear your application cache and any CDN cache: pages optimised earlier may still be stored there.