Files
baumer/.htaccess

89 lines
2.6 KiB
ApacheConf

# ======================================
# SICHERHEIT
# ======================================
# Schutz der Konfigurationsdatei
<Files "config.php">
Order allow,deny
Deny from all
</Files>
# Schutz der PHPMailer-Dateien (nur über PHP-Includes erreichbar)
<FilesMatch "^(PHPMailer|SMTP|Exception)\.php$">
Order allow,deny
Deny from all
</FilesMatch>
# Schutz vor Directory Browsing
Options -Indexes
# PHP Fehler nicht anzeigen (für Produktivbetrieb)
# Hinweis: php_flag funktioniert nur wenn PHP als Apache-Modul läuft
# Bei FastCGI/CGI: Verwenden Sie stattdessen .user.ini (siehe unten)
# php_flag display_errors Off
# php_flag log_errors On
# ======================================
# SEO & PERFORMANCE
# ======================================
# HTTPS Weiterleitung (aktivieren wenn SSL verfügbar)
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# www zu non-www Weiterleitung (oder umgekehrt)
# RewriteEngine On
# RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
# RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# ======================================
# GZIP KOMPRESSION
# ======================================
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json application/xml
</IfModule>
# ======================================
# BROWSER CACHING
# ======================================
<IfModule mod_expires.c>
ExpiresActive On
# Bilder
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
# CSS und JavaScript
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
# Fonts
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/font-woff2 "access plus 1 year"
# HTML
ExpiresByType text/html "access plus 1 hour"
# Favicon
ExpiresByType image/x-icon "access plus 1 year"
</IfModule>
# ======================================
# MIME TYPES
# ======================================
<IfModule mod_mime.c>
AddType application/javascript js
AddType text/css css
AddType image/svg+xml svg svgz
AddType font/woff woff
AddType font/woff2 woff2
</IfModule>