SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

August 30, 2014 6.8k views

Hi,
im trying to get deflate in .htacess for Magento root category to work but I only get an internal server error, and it’s beacuse of this line:
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

Dont understand what the problem is. im running ubuntu 14.04 with apache.

This is how it looks like in my Magento .htaccess

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
php_flag zlib.output_compression on
</IfModule>

<Files *.php>
SetOutputFilter DEFLATE
</Files>

<IfModule mod_ssl.c>
SSLOptions StdEnvVars
</IfModule>

<ifModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
Header unset ETag
Header unset Last-Modified
Header set Connection keep-alive
</ifModule>

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

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</IfModule>
1 Answer

Could you post the full error message that you’re seeing from Apache’s logs /var/log/apache2/error.log

One thing that jumps out at me is that this line seems to be broken into two:

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
php_flag zlib.output_compression on

when it should be all on one, like:

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary php_flag zlib.output_compression on

Is that what it looks like on your server?

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!