2

I've checked several threads and googled for a solution. But I can't get js?ver=X and css?ver=X compressed. Also for some odd reason .svgs from a certain folder show up aswell, while .svgs from other folders are being compressed.

Here's my .htaccess. According to everything I've read so far it should be fine. The compression also works on any other files except for those with ?ver and a few .svg

    # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

<IfModule mod_expires.c>
AddType application/vnd.ms-fontobject .eot 
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg
ExpiresActive On
ExpiresByType text/html "access plus 500 seconds"
ExpiresByType image/gif "access plus 14 days"
ExpiresByType image/ico "access plus 14 days"
ExpiresByType image/jpeg "access plus 14 days"
ExpiresByType image/jpg "access plus 14 days"
ExpiresByType image/png "access plus 14 days"
ExpiresByType text/css "access plus 14 days"
ExpiresByType text/javascript "access plus 14 days"
ExpiresByType application/x-javascript "access plus 14 days"
ExpiresByType application/javascript "access plus 14 days"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 14 days"
</IfModule>

Here are the some of the "Enable gzip compressions" I get from GTMetrix or PageSpeed Insights:

Compressing /wp-content/themes/Avada/assets/min/js/general/avada-header.js?ver=5.1.6 could save 25.0KiB (87% reduction).
Compressing /wp-content/themes/Avada/assets/css/style.min.css?ver=5.1.6 could save 132.7KiB (83% reduction).
Compressing /wp-content/themes/Avada-Child/images/icon-w-adresse.svg could save 494B (44% reduction).

Wordpress 4.7.5 + Theme: Avada 5.1.6

phr4pp
  • 21
  • 2
  • UPDATE: I've tried the following code in my functions.php: `// remove wp version param from any enqueued scripts function vc_remove_wp_ver_css_js( $src ) { if ( strpos( $src, 'ver=' ) ) $src = remove_query_arg( 'ver', $src ); return $src; } add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 ); add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );` It removed the "?ver=X" part in my GTMetrix/PageSpeed results, but they still show up. Could the cause for this be something else? – phr4pp Jun 01 '17 at 15:32
  • Check the `Content-Type` headers that are returned with the resources that are not being compressed. Is there a difference with the similar resources that are being compressed? – DocRoot Jun 01 '17 at 16:12
  • I didn't notice anything. Here's the website: http://www.klinger-tecnoseal.com/ – phr4pp Jun 02 '17 at 07:53
  • It doesn't seem to be the query string that's causing the problem... maybe the location of the files - any other `.htaccess` files? For instance, `http://www.klinger-tecnoseal.com/wp-content/themes/Avada/assets/min/js/general/avada-elastic-slider.js?ver=5.1.6` appears to be compressed, but `http://www.klinger-tecnoseal.com/wp-content/plugins/fusion-core/js/min/avada-fusion-slider.js?ver=1` is not? – DocRoot Jun 02 '17 at 13:59
  • That's the weird thing I can't get behind... I haven't found any other htaccess files except the one in the root folder. – phr4pp Jun 06 '17 at 11:50

1 Answers1

0

Mystery solved: For some reason the Server is Nginx unlike the other server which is Apache ... both from the same host. The Nginx settings have been adjusted and now everything works just fine.

phr4pp
  • 21
  • 2