3
respostas

Ativar compactação GZIP

Olá, não estou conseguindo ativar a compactação gzip na raiz de um projeto laravel hospedado em um servidor apache.

o htaccess esta desta forma

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

# BEGIN Expires
<ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 3 seconds"
    ExpiresByType text/html "access plus 3 seconds"
    ExpiresByType image/gif "access plus 2419200 seconds"
    ExpiresByType image/jpeg "access plus 2419200 seconds"
    ExpiresByType image/png "access plus 2419200 seconds"
    ExpiresByType text/css "access plus 2419200 seconds"
    ExpiresByType text/javascript "access plus 2419200 seconds"
    ExpiresByType application/x-javascript "access plus 2419200 seconds"
</ifModule>
# END Expires

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE image/svg+xml svg svgz
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-woff
    AddOutputFilterByType DEFLATE application/x-font-woff2
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/eot
    AddOutputFilterByType DEFLATE font/woff
    AddOutputFilterByType DEFLATE font/woff2
    AddOutputFilterByType DEFLATE font/opentype

  # For Olders Browsers Which Can't Handle Compression
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
3 respostas

Que estranho, parece ok a configuração. Vc pode passar a URL pra eu testar aqui tbm? Ou é privado?

Olá Sérgio http://www.festadocafecp.com.br/

Realmente, tem algo estranho aí.

Notei outra coisa: alem do GZIP nao estar funcionando, o Expires tbm nao esta. O request do HTML vem sem GZIP e sem Expires (apesar das duas configuracoes). Os outros requests parecem vir ok.

Existe alguma chance desse arquivo não estar sendo aplicado na raiz do projeto? Parece que só as coisas em /public estão sendo afetadas...