Thema: htaccess
Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 07.02.2022, 19:18
Dachlatte Dachlatte ist offline
Neuer Benutzer
neuer user
Thread-Ersteller
 
Registriert seit: 23.10.2021
Beiträge: 24
Dachlatte befindet sich auf einem aufstrebenden Ast
Standard htaccess

Guten Abend,
ich habe unsere Seite neu gemacht und bin jetzt noch dabei die Dinge im Hintergrund besser und vielleicht auch schneller zu machen. Die Zeilen in der htaccess habe ich mir aber schon immer zusammenkopieren müssen.. ich steige da einfach nicht durch

Code:
<ifmodule mod_headers.c>
  DefaultLanguage de
  
  # Header set X-XSS-Protection "1; mode=block"
  # X-XSS-Protection: 1; mode=block  / 13012021
  
  # Header set X-Frame-Options "sameorigin"
  # X-Frame-Options: SAMEORIGIN  / 13012021
  
  # Header set X-Content-Type-Options "nosniff"
  # X-Content-Type-Options: nosniff  / 13012021
  
  # Header set X-Permitted-Cross-Domain-Policies "none"  / 13012021
  
  # Use HTTP Strict Transport Security to force client to use secure connections only 
  # Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS
  # Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
  # Header always set Strict-Transport-Security: "max-age=31536000; includeSubDomains" env=HTTPS
  # Strict-Transport-Security: "max-age=31536000; includeSubDomains" env=HTTPS  / 13012021
  
  # Header set Content-Security-Policy "default-src * data:; script-src https: 'unsafe-inline' 'unsafe-eval'; style-src https: 'unsafe-inline'"
  ### Header set Content-Security-Policy: default-src 'self'
  # Header set Content-Security-Policy-Report-Only: policy 
  
  # Header set Referrer-Policy "no-referrer-when-downgrade"
  # Referrer-Policy: no-referrer
  # <meta name="referrer" content="no-referrer, same-origin">
  # Header set Referrer-Policy: no-referrer  / 13012021
  
  
  # Header set Expect-CT: enforce, max-age=31536000, report-uri="https://your.report-uri.com/r/d/ct/enforce"
  
  <FilesMatch "\.(js|css|xml|gz)$"> 
    Header append Vary Accept-Encoding 
  </FilesMatch> 
  
  <FilesMatch "\.(gif|ico|jpeg|jpg|png|css|js|webp|mp4)$">
    Header set Cache-Control "max-age=604800, public"
  </FilesMatch>

</IfModule>


<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
 
RewriteCond %{HTTP_HOST} ^wipfelglueck\.de$
RewriteRule ^(.*)$ https://www.wipfelglueck.de/$1 [R=301,L]
 
 
 # RewriteRule index.html$ /index.php    
 # RewriteCond %{REQUEST_URI} ^(.*)\.php$
 # RewriteRule ^(.*)\.html$ $1.php [nc,L]

</IfModule>

 <IfModule mod_deflate.c> 
 # Insert filters / compress text, html, javascript, css, xml: 
 AddOutputFilterByType DEFLATE text/plain 
 AddOutputFilterByType DEFLATE text/javascript 
 AddOutputFilterByType DEFLATE text/html 
 AddOutputFilterByType DEFLATE text/xml 
 AddOutputFilterByType DEFLATE text/css 
 AddOutputFilterByType DEFLATE text/vtt  
 AddOutputFilterByType DEFLATE text/x-component 
 AddOutputFilterByType DEFLATE application/xml 
 AddOutputFilterByType DEFLATE application/xhtml+xml 
 AddOutputFilterByType DEFLATE application/rss+xml 
 AddOutputFilterByType DEFLATE application/js 
 AddOutputFilterByType DEFLATE application/javascript 
 AddOutputFilterByType DEFLATE application/x-javascript 
 AddOutputFilterByType DEFLATE application/x-httpd-php 
 AddOutputFilterByType DEFLATE application/x-httpd-fastphp 
 AddOutputFilterByType DEFLATE application/atom+xml  
 AddOutputFilterByType DEFLATE application/json 
 AddOutputFilterByType DEFLATE application/ld+json  
 AddOutputFilterByType DEFLATE application/vnd.ms-fontobject  
 AddOutputFilterByType DEFLATE application/x-font-ttf  
 AddOutputFilterByType DEFLATE application/x-web-app-manifest+json  
 AddOutputFilterByType DEFLATE font/opentype  
 AddOutputFilterByType DEFLATE image/svg+xml 
 AddOutputFilterByType DEFLATE image/x-icon  

 
# Exception: Images 
SetEnvIfNoCase REQUEST_URI \.(?:gif|jpg|jpeg|png)$ no-gzip dont-vary 

 
# Drop problematic browsers 
BrowserMatch ^Mozilla/4 gzip-only-text/html 
BrowserMatch ^Mozilla/4\.0[678] no-gzip 
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 
 
</IfModule> 

<IfModule mod_gzip.c> 
   mod_gzip_on Yes 
   mod_gzip_dechunk Yes 
   mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ 
   mod_gzip_item_include handler ^cgi-script$ 
   mod_gzip_item_include mime ^text/.* 
   mod_gzip_item_include mime ^application/x-javascript.* 
   mod_gzip_item_exclude mime ^image/.* 
   mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* 
</IfModule> 


# turns cache on
# <IfModule mod_expires.c>
#  ExpiresActive On      
#  FileETag MTime Size
#  ExpiresByType text/html "access plus 500 seconds"
#  ExpiresByType image/gif "access plus 14 days"
#  ExpiresByType image/ico "access plus 14 days"
#  ExpiresByType image/jpeg "access plus 14 days"
#  ExpiresByType image/jpg "access plus 14 days"
#  ExpiresByType image/png "access plus 14 days"
#  ExpiresByType image/webp "access plus 14 days"
#  ExpiresByType text/css "access plus 500 seconds"
#  ExpiresByType text/javascript "access plus 500 seconds"
#  ExpiresByType application/x-javascript "access plus 500 seconds"
#  ExpiresByType application/javascript "access plus 500 seconds"
# </IfModule>
 
 


## Cache Expiration ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/html "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 month"
</IfModule>
## Cache Expiration
Kann mir bitte jemand sagen wie ich hier den Cache ordentlich aktiviere? Mit Google PageSpeed Insights wird mir die ganze Zeit angezeigt dass ich doch bitte die Files cachen soll. Was mache ich denn bitte falsch?
Wenn noch jemand etwas sagen könnte zu den Security-Headern wäre das auch total toll. Da komme ich mit den Hilfen im Web auch nicht weiter. Das mit dem CDN hatte ich mal hinbekommen, aber das war es meine ich dann auch..
Aber vor allem geht es mir im Moment um den Cache!
Besten Dank für Eure Unterstützung!
Gruß
Stefan
Mit Zitat antworten
Sponsored Links