Results 1 to 6 of 6
  1. #1
    Constant Pligger foofoo's Avatar
    Joined
    Aug 2010
    Posts
    127

    Exclamation How to force gzip for the pligg site using .htaccess

    How can we force gzip for the whole pligg setup website using .htaccess.
    I found some old topics covering this but none tell exact answer or are out dated.

    I enabled gzip from the backend. But it only works partial i read somewhere here or not for the js?

    When i test the pligg site with http://www.whatsmyip.org/http_compression/

    It says no no gzip enabled.

    So the question is how to enable gzip tru .htaccess for a pligg site.

  2. #2
    New Pligger Listing's Avatar
    Joined
    Aug 2011
    Posts
    25
    You have an option in your pannel admin in configure for Enable Gzip.

  3. #3
    Constant Pligger foofoo's Avatar
    Joined
    Aug 2010
    Posts
    127

    Exclamation

    Quote Originally Posted by Listing View Post
    You have an option in your pannel admin in configure for Enable Gzip.
    I have that option enabled. so either its only for the admin part or not for the whole site?.

    Hence the way of adding forcing enabling it tru .htaccess.

  4. #4
    Pligg Developer chuckroast's Avatar
    Joined
    Jun 2006
    Posts
    5,478
    It you read your .htaccess file you'll see a part that says

    ## Gzip Begin ##
    ## To enable Gzip and decrease the load times of your Pligg site
    ## change /home/path/to to your absolute server path and remove the # from the lines below
    # php_value auto_prepend_file /home/path/to/begin_gzip.php
    # php_value auto_append_file /home/path/to/end_gzip.php
    # AddType "text/javascript" .gz
    # AddEncoding gzip .gz
    # RewriteCond %{HTTP:Accept-encoding} gzip
    # RewriteCond %{THE_REQUEST} ^(.*).js
    # RewriteCond %{SCRIPT_FILENAME}.gz -f
    # RewriteRule ^(.*)\.js $1.js.gz [L]
    ## Gzip End ##

    You will also want to remove the # sign on each of the lines that start with only one #

  5. #5
    Constant Pligger foofoo's Avatar
    Joined
    Aug 2010
    Posts
    127

    Thanks for the answer it didnt work.!
    I found this topic today, http://forums.pligg.com/questions-co...p-problem.html.
    Here you gave extended info.!

    Ive put this <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>

    At the top of libs.html1.php.

    And i got the gzip working for the whole site.. Finaly some months later down this topic

    Question chuckroast or yankidank.

    Why does when inserting the above code gzip works.
    And not when i only use the .htaccess code you gave me. Do i use both? the code in .htaccess and the code in libs/html1.php ?

    Can i better use this code in the .htaccess instead of the other standard pligg gzipcode for the .htaccess?
    Code:
    # php compression – use with caution
    <ifmodule mod_php4.c>
    php_value zlib.output_compression 16386
    </ifmodule>
    
    # BEGIN Compress text files
    <IfModule mod_deflate.c>
    <FilesMatch "\.(css|js|x?html?|php)$">
    SetOutputFilter DEFLATE
    </FilesMatch>
    </IfModule>
    # END Compress text files
    # BEGIN Expire headers
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 seconds"
    ExpiresByType image/x-icon "access plus 2592000 seconds"
    ExpiresByType image/jpeg "access plus 2592000 seconds"
    ExpiresByType image/png "access plus 2592000 seconds"
    ExpiresByType image/gif "access plus 2592000 seconds"
    ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 216000 seconds"
    ExpiresByType application/x-javascript "access plus 216000 seconds"
    ExpiresByType text/html "access plus 600 seconds"
    ExpiresByType application/xhtml+xml "access plus 600 seconds"
    </IfModule>
    # END Expire headers
    # BEGIN Cache-Control Headers
    <IfModule mod_headers.c>
    <FilesMatch "\\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
    </FilesMatch>
    <FilesMatch "\\.(css)$">
    Header set Cache-Control "max-age=604800, public"
    </FilesMatch>
    <FilesMatch "\\.(js)$">
    Header set Cache-Control "max-age=216000, private"
    </FilesMatch>
    <FilesMatch "\\.(x?html?|php)$">
    Header set Cache-Control "max-age=600, private, must-revalidate"
    </FilesMatch>
    </IfModule>
    # END Cache-Control Headers
    # BEGIN Turn ETags Off
    <IfModule mod_headers.c>
    Header unset ETag
    </IfModule>
    FileETag None
    # END Turn ETags Off
    # BEGIN Remove Last-Modified Header
    <IfModule mod_headers.c>
    Header unset Last-Modified
    </IfModule>
    # END Remove Last-Modified Header
    How do you other pligg site owners have your gzip setup?

    Working or not and how ?


    And chuckroast in the other topic you explain this bout the js and {if}

    Code:
    Quote Originally Posted by chuckroast View Post
    Another thing you can try if you are still trying to get the gzip thing to work is go though your pligg.tpl file in your template. Near the top where there are javascript calls.. add the following to them {if $enable_gzip_files eq 'true'}.gz{/if} So it would look like this filename.js would now look like filename.js{if $enable_gzip_files eq 'true'}.gz{/if} Hope that helps.
    How would i ise that like below ? Is the code below good to compres the js with if ?

    {if check_for_enabled_module('jquery',0.2)}{else}<scri pt type="text/javascript" src="{$my_pligg_base}/templates/{$the_template}/js/jquery-1.4.2.min.js">{if $enable_gzip_files eq 'true'}.gz{/if}</script>{/if}


    Thanks in advance for your time.

  6. #6
    New Pligger tlq123's Avatar
    Joined
    May 2011
    Posts
    2
    Thanks for the information,I was searching for this since past 3 months and i am glad to see it here. Thanking you much

Similar Threads

  1. Replies: 9
    Last Post: 06-07-2010, 05:06 AM
  2. gzip, htaccess, and the 500 errors
    By knockoutchris in forum Questions & Comments
    Replies: 18
    Last Post: 08-12-2008, 04:51 PM
  3. .htaccess gzip produce server error
    By dtstyle in forum Questions & Comments
    Replies: 2
    Last Post: 06-24-2008, 05:24 AM
  4. Gzip enabled in both admin and .htaccess?
    By ditto in forum Questions & Comments
    Replies: 1
    Last Post: 01-16-2008, 04:15 AM
  5. Sales \force Launches their Pligg style voting site creation tool
    By dollars5 in forum Questions & Comments
    Replies: 2
    Last Post: 10-03-2007, 04:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Donate to Pligg CMS Dreamhost Web Hosting Host Gator Web Hosting