Jump to content

Recommended Posts

Tengo configurado prestashop con los servidores de medios de forma que las imágenes, el javascript y el css se sirven desde los subdominios static.xxxx.com, static1.xxxx.com y static2.xxxx.com.

 

El problema es que Pagespeed me dice que no tengo habilitada la compresión para los archivos que se sirven desde los subdominios. 

 

Si se comprime http://static1.xxxx.com/…ache/58f39d619807082dc1188b70ed9afd81.js, supondría un ahorro de 151,8 KB (reducción del 69%).
Si se comprime http://static1.xxxx.com/…cea260e1631c290f2fe12c4d78ddab7c_all.css, supondría un ahorro de 116,4 KB (reducción del 81%).
Si se comprime http://static1.xxxx.com/…op/themes/theme856/css/bootstrap.min.css, supondría un ahorro de 79,4 KB (reducción del 83%).
Si se comprime http://static.xxxx.com/…6/js/source/jquery.carouFredSel-6.2.1.js, supondría un ahorro de 40,1 KB (reducción del 75%).
Si se comprime http://static1.xxxx.com/shop/themes/theme856/css/responsive.css, supondría un ahorro de 20,8 KB (reducción del 83%).
Si se comprime http://static.xxxx.com/…emes/theme856/js/source/bootstrap.min.js, supondría un ahorro de 19,9 KB (reducción del 73%).
Si se comprime http://static.xxxx.com/…mes/theme856/js/source/jquery.uniform.js, supondría un ahorro de 18,5 KB (reducción del 72%).
Si se comprime http://static1.xxxx.com/shop/themes/theme856/css/font.css, supondría un ahorro de 18,5 KB (reducción del 80%).
Si se comprime http://static.xxxx.com/…me856/js/source/jquery.core-ui-select.js, supondría un ahorro de 12,7 KB (reducción del 79%).
Si se comprime http://static.xxxx.com/…op/themes/theme856/js/source/footable.js, supondría un ahorro de 10,9 KB (reducción del 69%).
Si se comprime http://static.xxxx.com/…/theme856/js/source/jquery.scrollpane.js, supondría un ahorro de 9,5 KB (reducción del 67%).
Si se comprime http://static.xxxx.com/…/themes/theme856/js/source/mainscript.js, supondría un ahorro de 8,2 KB (reducción del 73%).
Si se comprime http://static.xxxx.com/…me856/js/source/jquery.touchSwipe.min.js, supondría un ahorro de 6,9 KB (reducción del 66%).
Si se comprime http://static.xxxx.com/…hop/themes/theme856/js/source/plugins.js, supondría un ahorro de 5,1 KB (reducción del 65%).
Si se comprime http://static.xxxx.com/…/theme856/js/source/jquery.mousewheel.js, supondría un ahorro de 1,4 KB (reducción del 60%).

Supongo que habrá que poner alguna regla en el htaccess para que comprima también los archivos de los subdominios pero por más que pruebo no lo consigo. 

 

Este es mi htaccess actualmente: 

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule . - [E=HTTP_AUTHORIZATION:%1]

RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule . - [E=REWRITEBASE:/shop/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^static.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static1.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^static2.xxxx.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.xxxx.com$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresByType image/gif "access plus 1 month"
	ExpiresByType image/jpeg "access plus 1 month"
	ExpiresByType image/png "access plus 1 month"
	ExpiresByType text/css "access plus 1 week"
	ExpiresByType text/javascript "access plus 1 week"
	ExpiresByType application/javascript "access plus 1 week"
	ExpiresByType application/x-javascript "access plus 1 week"
	ExpiresByType image/x-icon "access plus 1 year"
</IfModule>

FileETag INode MTime Size
<IfModule mod_deflate.c>
	<IfModule mod_filter.c>
		AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript
	</IfModule>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /shop/index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again


<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary: Accept-Encoding
  </FilesMatch>
</IfModule>


RewriteCond %{REQUEST_FILENAME} "\.(htaccess.*|htpasswd.*|ini.*|phps.*|log.*|html.*|php.*|tpl.*)"
RewriteCond %{hTTP_HOST} ^static\.xxxx\.com [NC,OR]
RewriteCond %{hTTP_HOST} ^static1\.xxxx\.com [NC,OR]
RewriteCond %{hTTP_HOST} ^static2\.xxxx\.com [NC]
RewriteRule .* - [F]


# Allow access from all domains for webfonts.
<IfModule mod_headers.c>
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>

Os agradecería vuestra ayuda que ya llevo muchos días con esto. 

 

Gracias.

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...
  • 2 months later...
  • nadie locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...