htaccess für Leverage browser-caching funktioniert nicht
Ich habe Probleme mit Leverage browser caching.
Ich habe diese .htaccess-Datei, und nutze es auf meinem server aber es doesnt erscheinen zu sein Arbeit, habe ich kopiert von hier "http://www.samaxes.com/2011/05/improving-web-performance-with-apache-and-htaccess/".
Ich bin am meisten Hilfspersonal machen einen grundlegenden Fehler, so dass jede Hilfe wäre schön.
hier sind einige details. Ich arbeite auf einer subdomain nennen wir es "sub" und die Haupt-domain "Beispiel".
also ich möchte, dass alles in http://sub.example.com/ für die htaccess-Datei zu arbeiten.
auf meinem server habe ich gesetzt .htaccess-Datei in der sub main-Verzeichnis, das trennen, das Haupt zum Beispiel.
Mir läuft ein apache2 server mit sowohl Sie mod_headers. und mod_expires aktiviert auch.
Cheers.
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript application/json
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentype
</ifModule>
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$">
Header set Cache-Control "max-age=2592000, private"
Header set Expires "Sun, 17 July 2013 20:00:00 GMT"
</filesMatch>
<filesMatch "\\.(css|css.gz)$">
Header set Cache-Control "max-age=604800, private"
</filesMatch>
<filesMatch "\\.(js|js.gz)$">
Header set Cache-Control "max-age=604800, private"
</filesMatch>
<filesMatch "\\.(xml|txt)$">
Header set Cache-Control "max-age=216000, private, must-revalidate"
</filesMatch>
<filesMatch "\\.(html|htm)$">
Header set Cache-Control "max-age=7200, private, must-revalidate"
</filesMatch>
FileETag None
Haben Sie versucht, die
a2enmod expires
gefolgt von service apache2 restart
InformationsquelleAutor clonerworks | 2013-02-06
Du musst angemeldet sein, um einen Kommentar abzugeben.
sieht sehr unordentlich aus.
Haben Sie auch redundante Regeln wie
ExpiresByType application/javascript "access plus 216000 seconds"
und
Versuchen Sie es mit dem Reiniger (und aktuell) Regeln aus der html5-boilerplate oder Check-out all die
h5bp-server-configs
InformationsquelleAutor Anthony Hatzopoulos
nur diese eine und haben einen Versuch:
Wie @Antonius Hatzopoulos wies darauf hin, Sie sind mit doppelten Konfigurationen, und Sie könnte in Konflikt. Natürlich, wenn Sie möchten, können Sie verwenden "fileMatch" Weg als gut, aber die Sache ist, Sie sind nicht schön-code. Bitte beachten Sie, wenn Sie "fileMatch" dann musst du nicht den code verwenden.
InformationsquelleAutor Peter