问题
I have a wordpress website I'm creating for a client temporarily hosted on http://dev.eatfit.co.nz/
I'm noticing that often (but not every time) that I browse a page (for example the home page), what I assume is the google pagespeed online service seems to rewrite the url's on the fly to optimise things, so I get urls like this coming back to me (viewable in fiddler or in the .html source)
http://dev.eatfit.co.nz/wp-content/themes/eatfit/images/xfoot-logo.png.pagespeed.ic.SWoJqa9Ly9.png
I do not want to happen and I want to turn off the google pagespeed as it is incorrectly optimising the css and also constantly caching so testing updates is painful.
The strange thing is I've never turned on the online google pagespeed for this website and there are no special optimisation plug-ins in my wordpress install doing this. I looked up their online service and apparently you have to put in a special cname dns entry to get pagespeed to work - but no such cname exists on this domain.
It appears that somewhere between the hosting company server and my client computer the urls are being automatically rewritten. How is this happening and how can it be stopped.
回答1:
It looks like mod_pagespeed is installed on the host.
If you don't have access to disable it for your site, you can add ?ModPagespeed=off to the end of your URL in the browser like this
http://dev.eatfit.co.nz/?ModPagespeed=off
回答2:
If you look in your apache conf.d directory (mine is at /etc/httpd/conf.d), you should see a file called pagespeed.conf. To completely disable the service, find the line that says:
ModPagespeed on
and change it to:
ModPagespeed off
... then restart your httpd service with "service httpd restart".
回答3:
Those two replies are both accurate - The answer is yes it is an apache module installed by the hosting company on all accounts - to turn it off you can add the line below in your .htaccess file:
ModPagespeed off
回答4:
By the look of it, it is a module for apache, so it might be installed on your hosting server, I would contact your host if you haven't asked for it.
回答5:
I can confirm all the answers listed above. It looks like you've indeed turned it off via your .htaccess file. However I would like to know what functional problems you ran into with the CSS. I could not detect any visual difference on your home page with & without mod_pagespeed. If you found a bug we'd like to fix it.
It is true that it adds caching to your resources, but the server checks for changes every 5 minutes if you don't have an explicit TTL and writes out URLs with new content-hashes whenever the data changes. Even that 5-minute delay can admittedly get annoying while developing, but there is a relatively new feature: ModPagespeedLoadFromFile which makes deveoping with mod_pagespeed on much smoother and also improves server performance.
The benefits of all of this are that there are many fewer round-trips to your server and significantly lower latency to your end-users. Check out webpagetest results:
Video, mod_pagespeed on, mod_pagespeed off
Also, would you mind telling me what hosting provider you use that turns mod_pagespeed on by default? Thanks!
回答6:
For me it worked like this(Beware it would turn off pagespeed for all requests, no querystring ) :
vim /etc/apache2/mods-available/pagespeed.conf
#ModPagespeed on
ModPagespeed unplugged
:wq
I am commenting ModPagespeed on , and adding ModPagespeed unplugged line here. Hope it helps.
回答7:
Need to change in pagespeed.conf file from on to off
ModPagespeed off
Location of the file in Ubuntu/Debian
/etc/apache2/conf.d/pagespeed.conf
Location of the file in CentOS/httpd
/etc/httpd/conf.d/pagespeed.conf
Dont Forgot to restart apache or httpd services.
for individual website via .htaccess
ModPagespeed off
回答8:
And if you want pagespeed to stop changing your filenames ad this filter:
pagespeed InPlaceResourceOptimization on;
See here about that. Chapter is called "In-Place Resource Optimization"
Also if you define static files you will see changes right away and improve performance. See here about that. Seek chapter "Loading static files from disk"
回答9:
on my lamp installation on Elementary OS , the conf file of pagespeed is on
lampstack-(yourversion)/apache2/conf/pagespeed.conf
来源:https://stackoverflow.com/questions/8939504/how-to-stop-using-google-page-speed