Page 1 of 1

Performance ->htaccess

Posted: Tue Nov 10, 2009 2:38 pm
by doctorgrif
My version of the approach to the optimization and immediately apologize for bad English
Raw materials:
1. Sites (i'm took his - hospsurg.ru graybox.su)
2. FTP client (filezilla - my choice)
3. FF + YSlow
4. TEXT editor
5. The hands and head in a set

Start:
1. FF supply YSlow (Installation of extensions transparent, have done) and check the performance score for sites without optimization
initially I had all saytv were in the C band (well, average - for the ignorant)
2. FTP client crawls into your FTP and start raping htaccess (add at the end - it's easier then navigate)
a) The mechanism ETag (Entity Tag) is designed to detect new versions of the requested files. When the server sends the client a file, it adds a header ETag, in which writes the hash file form. Here, we ask, why do we need it? We often change the My Content?
cure:

Code: Select all

Header unset Pragma 
FileETag None 
b) Graphics (part of the template image in the content), js, CSS, site icon, included video and so on. Very rarely updated - in the cache of
and longer

Code: Select all

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> 
Header set Cache-Control "max-age = 290304000, public" 
Header unset Last-Modified 
</ FilesMatch> 
* Using Cache-Control header can specify how long the proxy server can store files in the cache.
** Remove Last-Modified header with the ETag header will completely avoid the use of queries test new versions of files If-Modified-Since and If-None-Match. Thus the files will be cached only on the basis of the available values of the Cache-Control and Expires.
*** Emphatically do not recommend deleting Last-Modified and ETag for. Html files.
3. minimization CSS and js
recommend 2 Resources http://www.codebeautifier.com/ (for css, works on csstidy 1.3) and http://dean.edwards.name/packer/ (for js) rejoice
4. CSS files make up head
means the index.php template move all css calls immediately after <head>
5. all js as low as possible (before the </ body>) - I'm talking about counters, analytics, metrics
obtain
PS: ksta - for those who wish can make and js-party extensions (comments, voting and so on.) Wrapped their terms
6. make calls in the template CSS from the modules, just putting them in the head, but the wrapping condition:

Code: Select all

<? php if ($ option == 'which should display') (?> <link href = "<? php echo $ mosConfig_live_site;?>/modules/modulename/filestyle.css" rel = "stylesheet" type = "text / css" /> <? php)?> 
in modules - comment on (these things // set before the line call)
7. owners apache2 deploy the compression (read - stuck in htaccess lines)

Code: Select all

<FilesMatch "\.(js|css)$"> 
SetOutputFilter DEFLATE 
</ FilesMatch> 
owners of version 1.* modestly chewed nervously smoking in aside (to which I am)
8. optimized graphics
advise http://sapegin.ru/picturebeaver for windows (there are references to the *nix/mac options like ...)
Outcome:
hospsurg.ru - Grade A Overall performance score 91
graybox.su - Grade A Overall performance score 91
And this is without gzip compression, CDN
Here, use
Special thanks to google.ru for "there is something to read," Cyril and Methodius for any letters to my parents for the phenotype and genotype, the wife - for beer :)
+
9. Browsers (by IE7 like the rest of the self-a) can "eat" style files and archived scripts and apache, including 1.* active in that panders to them, having in the default configuration of the corresponding module, which is 99,98 % cases activated for hosting
our actions:
templates_css.css-> templates_css.css.gz (gz - important)
*.js-> *.js.gz
Do not forget to change the names of files in scripts /* tested on your face gives hospsurg.ru scripts in *.gz
accordingly modify slightly p.6

Code: Select all

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|gz)$"> /* For perverts and can finish like this - | gz me | css.gz | js.gz 
Header set Cache-Control "max-age = 290304000, public" 
Header unset Last-Modified 
</ FilesMatch>

Re: Performance ->htaccess

Posted: Sat Feb 27, 2010 12:23 am
by prdg1
You are fabulous! You don't know how much this has helped my client. I will use ALL your tips with future clients.