Pagespeed caching css, annoying to develop

前端 未结 9 1927
耶瑟儿~
耶瑟儿~ 2020-12-29 23:45

I\'m working on a site which I havent coded from scratch and in firebug the css files are being displayed as: style.css.pagespeed.ce.5d2Z68nynm.css with the pagespeed extens

相关标签:
9条回答
  • 2020-12-30 00:21

    Another thing you can do is leave *mod_pagespeed* out of your ssl.conf file. This way, you can access your site via https for development.

    Kind of a hack, I know, but it's handy in some cases where you need to make very quick changes.

    0 讨论(0)
  • 2020-12-30 00:25

    To disable complete module, try to have the following code in your .htaccess file

    <IfModule pagespeed_module>
    ModPagespeed off
    </IfModule>
    
    0 讨论(0)
  • 2020-12-30 00:26

    Just as an aside, on this old post, I wrote a PHP script to delete the contents of the pagespeed cache folders (which I placed within the var/www/html area) and added a button to the Magento admin cache control page to call it. This way, whenever the Magento cache needs clearing I can also hit the button to clear the pagespeed cache. The script can be IP and admin restricted. This saves a lot of messing about. You could use a recursive delete folder function like this (careful with your paths!! :) ):

    function fullDeleteFolder($dir) { 
      echo "Remove: ".$dir."<br>";
        if (is_dir($dir)) { 
            $objects = scandir($dir); 
            foreach ($objects as $object) { 
                if ($object != "." && $object != "..") { 
                    if (is_dir($dir."/".$object)){
                        fullDeleteFolder($dir."/".$object);
                    }else{
                        unlink($dir."/".$object); 
                    }
                }
                }           
            rmdir($dir); 
        }
    }
    
    $location = "[some-location]/mpcache/mod_pagespeed";    
    fullDeleteFolder($location);
    //might also want to do this for the 'media/css_secure' folder too, if your site is on https
    echo "Finished.";
    
    0 讨论(0)
  • 2020-12-30 00:27

    GoDaddy Cloud Bitnami Config

    /stack/apache2/conf/nano pagespeed.conf

    Turn Off

    0 讨论(0)
  • 2020-12-30 00:28

    Another option for resetting the cache is described here:

    Find out where is the cache folder, it's defined in the config file under ModPagespeedFileCachePath property.

    Then run the following command from shell:

    touch <path_to_pagespeed_cache>/cache.flush
    (In my case: touch /var/cache/mod_pagespeed/cache.flush)
    

    That's it. The cache was reset.

    0 讨论(0)
  • 2020-12-30 00:29

    Alister is right. There are other two ways I know to do this. With a .htaccess shared through many domains and you want to disable PageSpeed only on a single domain, you can add to the bottom of the .htaccess file:

    <IfModule pagespeed_module>
      ...
      ModPagespeedDisallow http://www.example.com/*
    </IfModule>
    

    It means that you can have two domains, one for the developement (ModPagespeedDisallow) and one with ModPagespeed active. Never tried but should it works, avoiding visitor getting a not optimized page during development.

    Or you can add ?ModPagespeed=off to the url as stated on mod_pagespeed FAQ.

    0 讨论(0)
提交回复
热议问题