# ----------------------------------------------------------------------
# UTF-8 encoding
# ----------------------------------------------------------------------
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8
# Force UTF-8 for a number of file formats
AddCharset utf-8 .html .css .js .xml .json .rss .atom
# Wenn Sie 1und1 benutzen, setzen Sie die nächsten beiden Zeilen aktiv (Einschalten PHP5)
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
<IfModule mod_expires.c>
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 0 seconds"
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType image/x-icon "access plus 1 week"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
ExpiresByType text/x-component "access plus 1 month"
ExpiresByType font/truetype "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>
</IfModule>
# BEGIN Cache-Control Headers
<ifmodule mod_headers.c>
<filesmatch "\\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=31536000, public"
</filesmatch>
<filesmatch "\\.(css)$">
Header set Cache-Control "max-age=31536000, public"
</filesmatch>
<filesmatch "\\.(js)$">
Header set Cache-Control "max-age=31536000, public"
</filesmatch>
<filesmatch "\\.(ico)$">
Header set Cache-Control "max-age=31536000, public"
</filesmatch>
<filesmatch "\\.(html)$">
Header set Cache-Control "max-age=31536000, public"
</filesmatch>
</ifmodule>
<ifmodule mod_deflate.c>
<FilesMatch "\\.(js|css|html|htm|php|xml|jpg|jpeg|png|gif|ico)$">
SetOutputFilter DEFLATE
</FilesMatch>
</ifmodule>
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
</IfModule>
# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
<IfModule filter_module>
FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
</IfModule>
# ----------------------------------------------------------------------
# ETag removal
# ----------------------------------------------------------------------
# FileETag None is not enough for every server.
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
# developer.yahoo.com/performance/rules.html#etags
FileETag None
# Zusatzparameter PHP
#php_flag zlib.output_compression On
# Dateiauflisting unterbinden
Options -Indexes
# Kommentieren Sie diese Zeile aus, wenn Sie einen Fehler 500 (Internal Server Error) erhalten
#Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine On
#Sicherheit
## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.
# Port Scanner
RewriteCond %{HTTP_USER_AGENT} ^w00tw00t.at.ISC.SANS.DFind
RewriteRule ^.*$ 403.php [L]
# sitemap.xml auf Dynamische umleiten
RewriteRule ^(.*)sitemap.xml$ sitemap.xml.php [qsappend,L]
Options +SymLinksIfOwnerMatch
# Umleitung auf Adresse mit www, wenn www fehlt und nicht Subdomain und nicht localhost und nicht ssl.webpack.de
RewriteCond %{HTTP:X-Forwarded-Server} !^ssl\.webpack\.de$ [NC]
RewriteCond %{HTTP:X-Forwarded-Server} !^sslsites\.de$ [NC]
RewriteCond %{HTTP_HOST} !^www\..* [NC]
RewriteCond %{HTTP_HOST} !^.*\..*\..* [NC]
RewriteCond %{HTTP_HOST} !^localhost(.*)$ [NC]
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
# immer auf den root verweisen, damit die Startseite (/index.php) nicht zweimal vorkommt
# die folgenden beiden Zeilen auskommentieren wenn Sie eine index.html nutzen wollen
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?|php)\ HTTP/
RewriteRule ^index\.(html?|php)$ http://%%7bhttp_host%7d/ [R=301,L]
# Editieren Sie die untenstehende Zeile wenn ihr Shop in einem Unterordner läuft.
# Aber auch wenn Sie einen Fehler 500 (Internal Server Error) bekommen.
# Beispiel: Ist ihr Shop im Verzeichnis http://www.domain.de/shop ändern Sie die Zeile wie folgt: "RewriteBase /shop/"
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
# Alte Kategorien ohne Slash umleiten auf mit slash / Raute in den 4 Zeilen entfernen
#RewriteCond %{REQUEST_URI} !(.*)/$
#RewriteCond %{REQUEST_URI} !\..+$
#RewriteCond %{REQUEST_URI} !/$
#RewriteRule (.*) http://%%7bhttp_host%7d/%241/ [R=301,L]
RewriteRule ^(.*)(.+)404.php$ 404.php [qsappend,L]
RewriteRule ^(.*)tag/(.*([a-zA-Z0-9]))/$ taglisting.php?tag=$1$2 [qsappend,L]
RewriteRule ^(.*)keywords/(.*([a-zA-Z0-9]))$ advanced_search_result.php?keywords=$1$2 [qsappend,L]
RewriteRule ^(.*)manufacturer-(.*[0-9])/(.*([a-zA-Z0-9]))$ index.php?manufacturers_id=$2 [qsappend,L]
RewriteRule ^(.*)review-(.*[0-9])/(.*([a-zA-Z0-9]))$ product_reviews_info.php?reviews_id=$2 [qsappend,L]
#RewriteRule ^(.*)(.+)\.html(.*)$ commerce_seo_url.php?linkurl=$1$2$3 [qsappend,L]
RewriteCond %{REQUEST_FILENAME} !\.html$ [OR]
RewriteCond %{REQUEST_FILENAME} !\.php$ [OR]
RewriteRule ^(.*)$ commerce_seo_url.php?linkurl=$1 [qsappend,L]
</IfModule>
# Increase cookie security
<IfModule php5_module>
php_value session.cookie_httponly true
</IfModule>
ErrorDocument 404 /404.php
ErrorDocument 403 /403.php