Icy Phoenix

     
 


Tags And Keywordscache, gzip, headers, htaccess, performance, server

Post new topic  Reply to topic 
Page 1 of 1
 
 
Reply with quote Download Post 
Post SERVER - Improve Server Performances With Headers And GZIP 
 
Hi,
I have recently found this very interesting code to be added to templates/.htaccess to speed up page loading.

In particular this first part is for sending text files using GZIP to save bandwidth and speed up script and stylesheets loading:

Code: [Download] [Hide] [Select]
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>




This part is maybe more useful, because let's you add EXPIRES for some particular files (JS, CSS, templates images) allowing browsers to keep in cache (if they are not yet doing that) some common files which are rarely changed:

Code: [Download] [Hide] [Select]
<IfModule mod_expires.c>
    # Once per day I think is enough for most cases...
    ExpiresActive on
    ExpiresByType image/gif "access plus 1 day"
    ExpiresByType image/jpeg "access plus 1 day"
    ExpiresByType image/jpg "access plus 1 day"
    ExpiresByType image/png "access plus 1 day"
    ExpiresByType text/plain "access plus 1 day"
    #ExpiresByType text/html "access plus 15 minutes"
    #ExpiresByType text/tpl "access plus 15 minutes"
    ExpiresByType text/css "access plus 1 day"
    ExpiresByType text/javascript "access plus 1 day"
    ExpiresByType application/x-shockwave-flash "access plus 1 day"
</IfModule>



You can add both of these code to templates/.htaccess (just paste below the other code) or use only what you need / like... I personally use both of them here, and I think speed has improved.

Let me know if you have any questions about that.


P.S.: of course these pieces of codes will only work on thse servers with the right APACHE MODULES loaded.
 




____________
Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: SERVER - Improve Server Performances With Headers And GZIP 
 
good one MG

personaly, been using js compression and css compression for a while already.
 




____________
Out of Order
 
spydieSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: SERVER - Improve Server Performances With Headers And GZIP 
 
Thanks MG, I will test it
 




____________
TheSteffen
Often SEARCH is the quickest way to get support.
IcyPhoenix German Support
 
TheSteffenSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: SERVER - Improve Server Performances With Headers And GZIP 
 
Very nice. Thank you, MG. I noticed a difference right away.
 



 
nothereSend private message  
Back to topPage bottom
Post new topic  Reply to topic  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron