Disable mod_pagespeed (no server conf access, .htaccess doesn't work)
Asked Answered
A

4

33

I have a Wordpress site that my client wants to validate perfectly (using W3C validator). One of the issues is Google's pagespeed, which seems to be enabled by default by hosting provider.

I try to disable mod_pagespeed in .htaccess file with the following, but it doesn't work for some reason:

<IfModule pagespeed_module>
    ModPagespeed off
</IfModule>

I can disable it by adding "?ModPagespeed=off" to URL, but this does not solve my problem.

Is there anything else I can try? I only have access via FTP (no server conf access, no c-panel access, etc.).

Abhorrent answered 27/12, 2013 at 10:21 Comment(1)
If I put this code then it's reflected on our page speed?Drooff
S
5

Which hosting provider? Can you make sure your server is Apache rather than nginx? nginx doesn't support .htaccess files, though the PageSpeed module is otherwise very similar in function.

Also check out the 'pedantic' filter: https://developers.google.com/speed/pagespeed/module/filter-pedantic, which let's you get all the speed & bandwidth benefits of PageSpeed but still have a validation-clean site.

Seka answered 31/12, 2013 at 4:23 Comment(2)
Thank you for your answer. Hosting provider is Hostgator.com. How can I check if it runs apache or nginx? If it is indeed nginx, is there any alternative to .htaccess that I can take advantage of via FTP?Abhorrent
I would guess hostgator.com uses Apache, in which case putting an .htaccess file in the same directory as your content should enable you to add directives. I'm not sure why it didn't work. Maybe hostgator.com can help? Please post back if you get a response.Seka
C
47

Create a .htaccess file, add below text and upload using ftp program. We are also a hosting provider and use Pagespeed.

Modpagespeed Off
Comber answered 10/2, 2016 at 21:18 Comment(3)
@zarsky, this should be the accepted answer since it actually provides a solution and the other does not.Expanse
This worked for me - I agree it should be the accepted answerWehrle
Additionally I'd wrap above into "if" condition yet to determine if PageSpeed is available: <IfModule pagespeed_module>Modpagespeed Off</IfModule>Ogg
P
8

Your URL can accept the PageSpeed query-paramter with an off or on value.

http://www.example.com/index.html?PageSpeed=off

or

http://www.example.com/index.html?q=foo&PageSpeed=off

more here.

Phosphatize answered 12/3, 2018 at 20:2 Comment(0)
S
5

Which hosting provider? Can you make sure your server is Apache rather than nginx? nginx doesn't support .htaccess files, though the PageSpeed module is otherwise very similar in function.

Also check out the 'pedantic' filter: https://developers.google.com/speed/pagespeed/module/filter-pedantic, which let's you get all the speed & bandwidth benefits of PageSpeed but still have a validation-clean site.

Seka answered 31/12, 2013 at 4:23 Comment(2)
Thank you for your answer. Hosting provider is Hostgator.com. How can I check if it runs apache or nginx? If it is indeed nginx, is there any alternative to .htaccess that I can take advantage of via FTP?Abhorrent
I would guess hostgator.com uses Apache, in which case putting an .htaccess file in the same directory as your content should enable you to add directives. I'm not sure why it didn't work. Maybe hostgator.com can help? Please post back if you get a response.Seka
B
1

I had the same issue with my WordPress website, I had installed it on Google Cloud, and by default, the Application installed pagespeed mod for apache. But I found the solution on the Bitnami documentation page.

Check If PageSpeed Is Enabled

execute the command or edit conf file using FTP:

nano /opt/bitnami/apache2/conf/httpd.conf

And if you find these two lines:

Include conf/pagespeed.conf
Include conf/pagespeed_libraries.conf

That means pagespeed mod is enabled.

For Disable PageSpeed

execute the same command or edit conf file using FTP:

nano /opt/bitnami/apache2/conf/httpd.conf

Comment out the following lines as below:

#Include conf/pagespeed.conf
#Include conf/pagespeed_libraries.conf

Now restart the apache server

sudo /opt/bitnami/ctlscript.sh restart apache

Note:- As above mentioned, the command and the directory location would be changed depending on the Apache server location or your deployment application.

For a detailed article, check out the official Bitnami WordPress Documentation.

Brunel answered 24/1, 2021 at 14:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.