Search

 
Anmelden
Wissensdatenbank: Allgemeines
.htaccess: Webseite optimieren / Geschwindigkeit steigern
Gepostet von Support it factory ag an 19 December 2012 05:12 PM

Wie schnell eine Seite vom Server ausgeliefert wird hat heute sogar Einfluss auf die Suchmaschinen-Rankings. Es ist daher wichtig und sinnvoll dies zu optimieren. Dazu gibt es einige gute Artikel im Web. Wir empfehlen die Techniken aus diesem Artikel:

Improving web performance with Apache and htaccess

Folgendes muss dazu in der .htaccess eingetragen werden (die Gründe dazu siehe Artikel oben):

# Defining MIME types to ensure the web server knows them.
<IfModule mod_mime.c>
    AddType application/x-font-woff woff
</Ifmodule>

# Compress HTML, CSS, JavaScript, Text, XML and fonts
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript application/xhtml+xml application/xml application/x-font-woff
  AddOutputFilterByType DEFLATE font/opentype font/otf font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml image/x-icon
  AddOutputFilterByType DEFLATE text/css text/html text/javascript text/plain text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

# Expire headers
<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>
 
# Cache-Control Headers
<ifModule mod_headers.c>
  <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(css)$">
    Header set Cache-Control "public"
  </filesMatch>
  <filesMatch "\.(js)$">
    Header set Cache-Control "private"
  </filesMatch>
  <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "private, must-revalidate"
  </filesMatch>
</ifModule>
 
# Turn ETags Off
FileETag None



Kommentare (0)