GZIP and Concrete5
Permalink 8 users found helpful
I have been working on my site load speed (as Google complains its slow)...discovered gzip but not how to use it....now this might be trivia to some of you, I know, but as a novice I thought this would be useful for other newcomers....
I found this on google and added it to my .htaccess file
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_can_negotiate Yes
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
mod_gzip_update_static No
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_keep_workfiles No
mod_gzip_minimum_file_size 500
mod_gzip_maximum_file_size 500000
mod_gzip_maximum_inmem_size 60000
mod_gzip_min_http 1000
mod_gzip_handle_methods GET POST
mod_gzip_item_exclude reqheader "User-agent: Mozilla/4.0[678]"
mod_gzip_item_exclude mime ^image/
mod_gzip_item_exclude file \.js$
mod_gzip_item_exclude file \.css$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include mime ^text/plain$
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_dechunk Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary On
</IfModule>
Now I dont know if this is good/bad or otherwise, perhaps someone learned friend in the community can advise...
I found this on google and added it to my .htaccess file
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_can_negotiate Yes
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
mod_gzip_update_static No
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_keep_workfiles No
mod_gzip_minimum_file_size 500
mod_gzip_maximum_file_size 500000
mod_gzip_maximum_inmem_size 60000
mod_gzip_min_http 1000
mod_gzip_handle_methods GET POST
mod_gzip_item_exclude reqheader "User-agent: Mozilla/4.0[678]"
mod_gzip_item_exclude mime ^image/
mod_gzip_item_exclude file \.js$
mod_gzip_item_exclude file \.css$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include mime ^text/plain$
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_dechunk Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary On
</IfModule>
Now I dont know if this is good/bad or otherwise, perhaps someone learned friend in the community can advise...
add this: it will increase your yslow grade and google page speed grade by a lot:
AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript ExpiresActive On ExpiresDefault "access plus 30 days" FileETag none
OK, I'll try and test!
Thnx!
Thnx!
Just realised my server had this option and my sites speeds have increases dramatically. My own site saved over 70% in file sizes.
Nice one!!
Nice one!!
Thank you very much.
Also found this useful link on gzip
http://betterexplained.com/articles/how-to-optimize-your-site-with-...
Also found this useful link on gzip
http://betterexplained.com/articles/how-to-optimize-your-site-with-...
hi Guys
Stupid question but should I just paste the above code in it .htcaccess located in my theme folder or do i need to go to the root folder?
/Mike
Stupid question but should I just paste the above code in it .htcaccess located in my theme folder or do i need to go to the root folder?
/Mike
Hi,
In root folder, you don't need another one!
In root folder, you don't need another one!
hi 55webdesign
I thought that one should place it in the htacces. (where you add her Pretty URLs) file located in my theme folder ex. concrete / themes / themename /, but is it the same as placing it in the root folder? :-)
Thanks again Mike ps. i think my site in running faster now .. but are not sure if it's just the cache :-)
/ Mike (major Noob! :-))
I thought that one should place it in the htacces. (where you add her Pretty URLs) file located in my theme folder ex. concrete / themes / themename /, but is it the same as placing it in the root folder? :-)
Thanks again Mike ps. i think my site in running faster now .. but are not sure if it's just the cache :-)
/ Mike (major Noob! :-))
I've added the code and if I check my website with the Firefox "Live HTTP header" plugin I do get "Content-Encoding: gzip" so gzip is switched on.
However, if I check my website on http://www.whatsmyip.org/http-compression-test/... orhttp://www.gidnetwork.com/tools/gzip-test.php... it says my site is not gzipped?! Have I missed something?
Thanks
Sissi
However, if I check my website on http://www.whatsmyip.org/http-compression-test/... orhttp://www.gidnetwork.com/tools/gzip-test.php... it says my site is not gzipped?! Have I missed something?
Thanks
Sissi
What code have you added and where?
This is what is in my .htaccess.
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<FilesMatch "\.(js|css|php|eot|ttf|otf|svg|html|)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
Which does two things, one for gzip and one for page speed.
This is what is in my .htaccess.
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
<FilesMatch "\.(js|css|php|eot|ttf|otf|svg|html|)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
Which does two things, one for gzip and one for page speed.
In my .htacess is the code that Mnkras posted and that is marked "green" above.....
Hmmmm...how do I actually ensure that the server is serving compressed versions of my file?!
Hmmmm...how do I actually ensure that the server is serving compressed versions of my file?!
Sorry, but either your server is not set up properly or you need to change the .htaccess file.
All sites I run use my code above?
All servers have mod_deflate active, check with your hosting provider.
All sites I run use my code above?
All servers have mod_deflate active, check with your hosting provider.
Also note that for the method used in the green comment, mod_expires needs to be active too.
This what I did to enable gzip on my site which is hosted on a 1and1 server,
Add this line to your htaccess file:
create a php.ini file and add this line to it
put the php.ini file in the root of your site (same place as the htaccess file)
And test it!
Add this line to your htaccess file:
AddType x-mapp-php5 .php
create a php.ini file and add this line to it
zlib.output_compression = On
put the php.ini file in the root of your site (same place as the htaccess file)
And test it!
Wow I just tried that and it works AMAZING. Fastest gzip I've had to date.
This should be in the how-tos.
This should be in the how-tos.
Wow. I owe Mnkras and all of you here a huge Thanks! This has improved my client's GTmetrix score from "D" to "A" with just these additions.
if it helps anyone else, I was getting a score of "F" until I added the following Expires, which increased Page Load Speed significantly:
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year”
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month”
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
if it helps anyone else, I was getting a score of "F" until I added the following Expires, which increased Page Load Speed significantly:
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year”
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month”
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
Is there any solution for websites hosted on IIS Server ?? As IIS does not use .htaccess file the current solution is not feasible
Have you tried the IIS manger?
Just open the IIS Manager > Click on the site > Then click on URL Rewrite > Import rules
You can import the rules you have from the .HTACCESS to your IIS
This link might help: https://www.supinfo.com/articles/single/4737-using-the-htaccess-rule...
Just open the IIS Manager > Click on the site > Then click on URL Rewrite > Import rules
You can import the rules you have from the .HTACCESS to your IIS
This link might help: https://www.supinfo.com/articles/single/4737-using-the-htaccess-rule...
Enabling gzip support massively increases the speed of any site. Users who are experiencing performance issues should check that it is active and working. It was not enabled by default on our WHM/CPanel installation.
Does anyone know how to compress site files through an iss server? Should this work for that as well? I've tried these solutions but none of them shows that the file is gzipped when I check on....
http://www.whatsmyip.org/http-compression-test/...
I don't think .htaccess works with iis. I would make the changes suggested at....
technet.microsoft.com/en-us/library/cc771003(WS.10).aspx
but the host/server administrator won't give me access to cpanel or php.ini (If there even is one for IIS, I don't really know)
Any help would be much appreciated as my site is still fairly slow at times. You can view the site athttp://www.eclinicalsol.com
http://www.whatsmyip.org/http-compression-test/...
I don't think .htaccess works with iis. I would make the changes suggested at....
technet.microsoft.com/en-us/library/cc771003(WS.10).aspx
but the host/server administrator won't give me access to cpanel or php.ini (If there even is one for IIS, I don't really know)
Any help would be much appreciated as my site is still fairly slow at times. You can view the site athttp://www.eclinicalsol.com
I used Mnkras code in my .htaccess and worked great.BUT, I have several websites in my hosting account.When using the code in the a sub domain then it says no compression enabled.
Anyone here know how to fix this.
i have
maindomain.com (works)
sub.maindomain.com (not working)
Thanks in advance
Anyone here know how to fix this.
i have
maindomain.com (works)
sub.maindomain.com (not working)
Thanks in advance
I went crazy for a while with Bluehost trying to figure out why everything was in place but files were not gzipped. Turns out bluehost only allows gzipping on some files (html I think) but not on scripts or css => pretty useless.
I am saying that because most shared hosts will tell you of course gzip is enabled and they won't tell you it's limited to the point of being useless.
I am saying that because most shared hosts will tell you of course gzip is enabled and they won't tell you it's limited to the point of being useless.
Compressing some kinds of files can have little or no effect on size and simply wastes processor time.
eg. Files that are already compressed such as zip files, jpeg files and many kinds of video and sound files.
The benefit of zipping of some uncompressed graphic files types can be marginal (better to use a compressed file type) and can be enormously expensive in processor time for large files.
Compression is most effective on text based file types because they have a lot of wastage and repetitive sequences in the their content.
Hence a host that prohibits compression of some kinds of files could actually be doing a good job.
Nevertheless, script and css files are types I agree should be zippable.
eg. Files that are already compressed such as zip files, jpeg files and many kinds of video and sound files.
The benefit of zipping of some uncompressed graphic files types can be marginal (better to use a compressed file type) and can be enormously expensive in processor time for large files.
Compression is most effective on text based file types because they have a lot of wastage and repetitive sequences in the their content.
Hence a host that prohibits compression of some kinds of files could actually be doing a good job.
Nevertheless, script and css files are types I agree should be zippable.
and check your site at :http://www.whatsmyip.org/http_compression/...
If your server doesn't support .htaccess, you can allso add the following code to the very first beginning of your C5 template, my header element looks like this:
And check again!
and check your site at:http://www.whatsmyip.org/http_compression/...
update 5.4.1
doesn't work no more...