Próbuję przyspieszyć moją stronę. W Google PageSpeed Insights mam 86 punktów, ale mam z tym problem Leverage browser caching
. W poleceniu znalazłem ten kawałek .htaccess
kod:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##
Ale kiedy wstawię to do mojego .htaccess
plik Otrzymuję błąd serwera wewnętrznego (500).
Moja praca .htaccess
kod loks w ten sposób:
AddHandler x-httpd-php53 .php
RewriteEngine On
RewriteBase /
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
# Don"t compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
Co robię źle?
Odpowiedzi:
0 dla odpowiedzi № 1Myślę, że powinieneś włączyć moduł "mod_expires" na serwerze: przy użyciu typu serwera ubuntu:
a2enmod wygasa
/etc/init.d/apache2 restart