wdrożenia PrestaShop Powiększenie zdjęć moduł

optymalizacja i kompresja

  • 0 Odpowiedzi
  • 3082 Wyświetleń

0 użytkowników i 1 Gość przegląda ten wątek.

*

Offline regnarok

  • Użytkownik
  • **
  • 24
  • 0
optymalizacja i kompresja
« dnia: Grudzień 03, 2012, 11:03:45 am »
Uruchomiłem google page speed test żeby sprawdzić ile mam punktów i wyszło że niestety tylko 54/100. Wyskoczyły mi dwa komunikaty z wysokim priorytetem, że muszę włączyć kompresję oraz wykorzystać pamięć podręczną przeglądarki (w plikach graficznych nie określono daty wygaśnięcia). Postanowiłem zadziałać, dodam że mam domenę na serwerach home.pl oraz wykupiony SSL. Stworzyłem php.ini do katalogu głównego aby upewnić się że jest włączona opcja kompresji gzip.
Tak wygląda mój php.ini:

; Enable GZIP compression at the default level
zlib.output_compression = On
zlib.output_compression_level = 8

; Disable PHP magic quotes
magic_quotes_gpc = On
magic_quotes_runtime = On
magic_quotes_sybase = On

; Load mcrypt extension
extension=mcrypt.so


Następnym krokiem było uaktualnienie .htaccess wg tych wskazówek :
http://www.samaxes.com/2008/04/htaccess-gzip-and-cache-your-site-for-faster-loading-and-bandwidth-saving/

Po tym zabiegu plik .htaccess wygląda następująco:

<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 ^Content-Encoding:.*gzip.*
</ifModule>

<IfModule mod_rewrite.c>
# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^api/?(.*)$ /webservice/dispatcher.php?url=$1 [QSA,L]
RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg [L]
RewriteRule ^([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg [L]
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$1$2.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L]
RewriteRule ^c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\.jpg$ /img/c/$1.jpg [L]
RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 [QSA,L]
RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 [QSA,L]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 [QSA,L]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 [QSA,L]
RewriteRule ^content/category/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms_category=$1 [QSA,L]
RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L]
RewriteRule ^blad-404$ /404.php [QSA,L]
RewriteRule ^adres$ /address.php [QSA,L]
RewriteRule ^adresy$ /addresses.php [QSA,L]
RewriteRule ^uwierzytelnianie$ /authentication.php [QSA,L]
RewriteRule ^hity-sprzedazy$ /best-sales.php [QSA,L]
RewriteRule ^koszyk$ /cart.php [QSA,L]
RewriteRule ^kontakt-z-nami$ /contact-form.php [QSA,L]
RewriteRule ^znizki$ /discount.php [QSA,L]
RewriteRule ^tracking$ /guest-tracking.php [QSA,L]
RewriteRule ^historia-zamowien$ /history.php [QSA,L]
RewriteRule ^tozsamosc$ /identity.php [QSA,L]
RewriteRule ^producenci$ /manufacturer.php [QSA,L]
RewriteRule ^moje-konto$ /my-account.php [QSA,L]
RewriteRule ^nowe-produkty$ /new-products.php [QSA,L]
RewriteRule ^zamowienia$ /order.php [QSA,L]
RewriteRule ^obsluga-zamowienia$ /order-follow.php [QSA,L]
RewriteRule ^szybkie-zamowienie$ /order-opc.php [QSA,L]
RewriteRule ^arkusz-zamowienia$ /order-slip.php [QSA,L]
RewriteRule ^haslo$ /password.php [QSA,L]
RewriteRule ^promocje$ /prices-drop.php [QSA,L]
RewriteRule ^wyszukiwanie$ /search.php [QSA,L]
RewriteRule ^mapa-strony$ /sitemap.php [QSA,L]
RewriteRule ^sklepy$ /stores.php [QSA,L]
RewriteRule ^dostawcy$ /supplier.php [QSA,L]
</IfModule>

# Catch 404 errors
ErrorDocument 404 /404.php

<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType image/jpg "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "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"
</ifModule>

<ifModule mod_headers.c>
  <filesmatch "\\.(ico|pdf|flv|jpg|jpeg|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 "\\.(xml|txt)$">
    Header set Cache-Control "max-age=216000, public, must-revalidate"
  </filesMatch>
  <filesmatch "\\.(html|htm|php)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
  </filesmatch>
</ifModule>

<ifModule mod_headers.c>
  Header unset ETag
</ifModule>
FileETag None

<ifModule mod_headers.c>
  Header unset Last-Modified
</ifModule>

<IfModule mod_deflate.c>
   AddOutputFilterByType DEFLATE text/html
   AddOutputFilterByType DEFLATE text/css
   AddOutputFilterByType DEFLATE text/javascript
   AddOutputFilterByType DEFLATE application/javascript
   AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>




Niestety to prawie nic nie pomogło  w teście google speeda, jak to rozwiązać? Jakieś pomysły będę wdzięczny.