RewriteEngine OnRewriteCond %{SERVER_PORT} !=443RewriteRule ^(.*)$ https://www.xxxxxx-xxxxxxxxxxxx.de/$1 [R=301,L]RewriteCond %{REQUEST_URI} ^/sitemap.xmlRewriteRule .* /index.php?option=com_xmap&view=xml&id=1IndexIgnore *Options +FollowSymlinksOptions -IndexesRewriteEngine OnRewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})RewriteRule .* index.php [F]RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]RewriteCond %{REQUEST_URI} !^/index\.phpRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule .* index.php [L]<IfModule mod_headers.c> <FilesMatch ".(js|css|xml|gz|html)$"> Header append Vary: Accept-Encoding </FilesMatch></IfModule><IfModule mod_expires.c> ExpiresActive On <FilesMatch "\.(css|js)$"> ExpiresDefault "access 1 month" </FilesMatch> <FilesMatch "\.(jpg|jpeg|gif|png|ico)$"> ExpiresDefault "access 6 months" </FilesMatch> <FilesMatch "\.(mp3|flv|pdf|woff|eot|ttf|otf|woff2|svg)$"> ExpiresDefault "access 1 year" </FilesMatch> AddType application/vnd.ms-fontobject .eot AddType font/ttf .ttf AddType font/otf .otf AddType font/x-woff .woff AddType image/svg+xml .svg AddOutputFilterByType DEFLATE font/ttf font/x-woff font/otf image/svg+xml</IfModule><IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/atom_xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-shockwave-flash</IfModule>
Pagespeed erkennt weder das Caching noch die Komprimmierung.
Nun kommt das Interessante: Das ist meine .htaccess von einem anderen Projekt. Bei diesem projekt habe ich keine Probleme mit Caching/Kompression:
<FilesMatch "\.js\.gzip$"> AddType "text/javascript" .gzip</FilesMatch><FilesMatch "\.css\.gzip$"> AddType "text/css" .gzip</FilesMatch><FilesMatch "\.ts" > deny from all</FilesMatch>AddEncoding gzip .gzipRewriteEngine OnRewriteRule ^typo3$ - [L]RewriteRule ^typo3/.*$ - [L]RewriteRule ^uploads/.*$ - [L]RewriteRule ^fileadmin/.*$ - [L]RewriteRule ^typo3conf/.*$ - [L]RewriteRule ^cwm.*$ /typo3/index_re.php [L]RewriteRule ^clubwebman.*$ /typo3/index_re.php [L]RewriteRule ^cf.*$ /typo3/index_re.php [L]RewriteRule ^contentfactory.*$ /typo3/index_re.php [L]RewriteRule ^cfdent.*$ /typo3/index_re.php [L]RewriteRule ^contentfactorydent.*$ /typo3/index_re.php [L]RewriteRule ^gkmb.*$ /typo3/index_re.php [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-lRewriteRule .* /index.php ExpiresActive On ExpiresByType text/css "access plus 1 month" ExpiresByType text/javascript "access plus 1 month" ExpiresByType text/html "access plus 1 month" ExpiresByType application/javascript "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType image/x-icon "access plus 1 month"Header unset ETagFileETag None AddType application/vnd.ms-fontobject .eotAddType font/ttf .ttfAddType font/otf .otfAddType font/woff .woff<FilesMatch "\.(ttf|otf|eot|woff)$"><IfModule mod_headers.c>Header set Access-Control-Allow-Origin "*"</IfModule></FilesMatch>
Und die Seite läuft super und Pagespeed erkennt sowohl die kompression als auch das Caching.
Mein Gedanke ist natürlich das erste mit dem 2. zu überschreiben. Wenn ich das aber tue bekomme ich folgenden Fehler. Also habe ich die htaccess entsprechend angepasst:
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://www.xxxxxxxx-xxxxxxxx.de/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&id=1
IndexIgnore *
Options +FollowSymlinks
Options -Indexes
RewriteEngine On
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/html "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
<FilesMatch "\.js\.gzip$">
AddType "text/javascript" .gzip
</FilesMatch>
<FilesMatch "\.css\.gzip$">
AddType "text/css" .gzip
</FilesMatch>
<FilesMatch "\.ts" >
deny from all
</FilesMatch>
AddEncoding gzip .gzip
Alles anzeigen
Und darauf bekomme ich nur folgende Fehlermeldung:
Zitat
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator to inform of the time the error occurred
and of anything you might have done that may have
caused the error.
More information about this error may be available
in the server error log.
Alles anzeigen