开发者

Content encoding error in a Smarty-based web application

I have developed a Smarty-based web application, but a page is very heavy due to Google Maps and a lot of HTML code.

It's all about greater than 1 MB at load time. I am trying to compress it, because it is updating frequently.

I used: .htaccess configuration for compressing like:

<IfModule mod_gzip.c>
    mod_gzip_on       Yes
    mod_gzip_dechunk  Yes
    mod_gzip_item_include file      \.(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler   ^cgi-script$
    mod_gzip_item_include mime      ^text/.*
    mod_gzip_item_include mime      ^application/x-javascript.*
    mod_gzip_item_exclude mime      ^image/.*
    mod_gzip_item_exclude rspheader ^Co开发者_如何学JAVAntent-Encoding:.*gzip.*
</IfModule>

...but nothing happens.

I also tried the php gzip and ob_start() method, but it is throwing a content encoding error. How can I make it possible?


  1. We have some problems of the encoding procedure. Sometimes we miss for the encoding command. If we follow the real procedure (command) or encoding software, then our problem may be solved in this case.

    As an example, we want to make a .gzip file:

    gzip -9 production.min.css
    

    It will make the production.min.css.gz file.

  2. Sometimes it may occur, if your configuration to pick data from various server as Apache and others. The solution is to turn on zlib.output_compression in your php.ini.

    Open your php.ini. On Debian/Ubuntu, it's /etc/php5/apache2/php.ini:

    vi /etc/php5/apache2/php.ini
    

    On Fedora, CentOS, and Red Hat Linux, it's /etc/php.ini:

    vi /etc/php.ini
    

    Find the zlib.output_compression line and turn zlib.output_compression on:

    zlib.output_compression = On
    

    Restart Apache afterwards:

    On Debian and Ubuntu, you run:

    /etc/init.d/apache2 restart
    

    On Fedora/CentOS/RedHat, you run:

    /etc/init.d/httpd restart
    
  3. Clear your browser cache, cookies, etc. just to be sure.

    It most likely will not fix the problem permanently or even temporarily.

  4. It could be an issue with gzip.

    Open a new tab and enter the following "about:config", and then you'll see a warning to be careful. Just confirm it.

    In the search bar, enter "network.http.accept-encoding". Make sure its value is gzip, deflate. If not, right click it and click the option to reset.

    Some people report changing it to "true". It can fix the problem, but I would not recommend it since it's most likely going to cause more problems down the road.

  5. Check your firewall especially if you're using ZoneAlarm. Removing all the added programs and resetting the defaults actually fixed it the first time for me.

  6. Clear your SSL slate by going into your control panel then clicking Internet options.

    Once open, click the Content tab and click Clear SSL slate.

  7. Are you using a custom DNS? I.e., OpenNIC. If so, turn it off to make sure. If you don't know what I'm talking about, ignore this.

  8. Run a good privacy cleaning program like Advanced SystemCare or whatever you use to do that.

    The last time it happened to me, I did all of the following followed by a reboot.

    I've not had the issue again in any browser and it's been a good while now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜