Hallo, um meine Webseite schneller zu machen habe ich im Internet nach ein paar Lösungen gesucht und bin häufiger auf Codeschnipsel gestoßen, die man in die .htaccess Datein hinzufügen soll (das soll Caching, g-zip compression, usw. bewirken). Ich habe nun alle Schnipsel in die Datei hinzugefügt, weiß aber nicht, ob das ganze korrekt/funktionstüchtig/sinnvoll ist. Könnte bitte jemand der sich mit coden auskennt einmal rübergucken und mir sagen, ob das ganze Hand und Fuß hat, danke.
Ps. Ich möchte weiterhin Cachingplugins wie z.B. W3 total Cache benutzen, muss man dabei irgendwas beachten?
Apache Configuration
# BEGIN WordPress
#
RewriteEngine on
#
# Unless you have set a different RewriteBase preceding this point,
# you may delete or comment-out the following RewriteBase directive
# RewriteBase /
#
# if this request is for "/" or has already been rewritten to WP
RewriteCond $1 ^(index\.php)?$ [OR]
# or if request is for image, css, or js file
RewriteCond $1 \.(gif¦jpg¦ico¦css¦js)$ [NC,OR]
# or if URL resolves to existing file
RewriteCond %{REQUEST_FILENAME} -f [OR]
# or if URL resolves to existing directory
RewriteCond %{REQUEST_FILENAME} -d
# then skip the rewrite to WP
RewriteRule ^(.*)$ - [S=1]
# else rewrite the request to WP
RewriteRule . /index.php [L]
#
# END wordpress
# compress text, html, javascript, css, xml:
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
AddType x-font/otf .otf
AddType x-font/ttf .ttf
AddType x-font/eot .eot
AddType x-font/woff .woff
AddType image/x-icon .ico
AddType image/png .png
AddType text/css .css
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
# Set up caching on dynamic media files
<filesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
# Set up caching on static media files
<filesMatch "\.(gif|jpg|jpeg|png|swf|jss|css)$">
ExpiresDefault A604800
Header append Cache-Control "public"
# Set up caching on javascript and jquery files
<filesMatch "(jquery|js)">
ExpiresDefault A604800
Header append Cache-Control "public"
# Set up caching on commonly updated files
<filesMatch "\.(xml|txt|html)$">
ExpiresDefault A7200
Header append Cache-Control "proxy-revalidate"
# Force no caching for dynamic files
<filesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedEnableFilters extend_cache
</IfModule>
AddType image/x-icon .ico
<IfModule mod_headers.c>
# YEAR
<FilesMatch "\.(ico|gif|jpg|jpeg|png|flv|pdf)$">
Header set Cache-Control "max-age=29030400"
</FilesMatch>
# WEEK
<FilesMatch "\.(js|css|swf)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# 24 HOURS
<FilesMatch "\.(html|htm|txt|php)$">
Header set Cache-Control "max-age=86400"
</FilesMatch>
</IfModule>
#CSS-JS-Booster Start#################################################
#Turn ETagging off
FileETag none
#Turn ETagging on for MHTML-file
<FilesMatch ".*booster_mhtml\.php$">
FileETag MTime Size
</FilesMatch>
Alles anzeigen