mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 10:28:43 +00:00
110 lines
3.3 KiB
ApacheConf
110 lines
3.3 KiB
ApacheConf
# HexaHost.de .htaccess
|
|
# Sicherheit und Performance-Optimierungen
|
|
|
|
# Sicherheitsheader
|
|
<IfModule mod_headers.c>
|
|
Header always set X-Content-Type-Options nosniff
|
|
Header always set X-Frame-Options DENY
|
|
Header always set X-XSS-Protection "1; mode=block"
|
|
Header always set Referrer-Policy "strict-origin-when-cross-origin"
|
|
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
|
|
</IfModule>
|
|
|
|
# HTTPS erzwingen (falls SSL verfügbar)
|
|
<IfModule mod_rewrite.c>
|
|
RewriteEngine On
|
|
RewriteCond %{HTTPS} off
|
|
RewriteCond %{HTTP_HOST} ^(www\.)?hexahost\.de$ [NC]
|
|
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
|
|
# HTML zu PHP Weiterleitungen
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteRule ^([^\.]+)\.html$ $1.php [L,R=301]
|
|
|
|
# Direkte HTML zu PHP Weiterleitungen für bekannte Seiten
|
|
RewriteRule ^index\.html$ index.php [L,R=301]
|
|
RewriteRule ^about\.html$ about.php [L,R=301]
|
|
RewriteRule ^contact\.html$ contact.php [L,R=301]
|
|
RewriteRule ^vpc\.html$ vpc.php [L,R=301]
|
|
RewriteRule ^vps\.html$ vps.php [L,R=301]
|
|
RewriteRule ^webhosting\.html$ webhosting.php [L,R=301]
|
|
RewriteRule ^mail-gateway\.html$ mail-gateway.php [L,R=301]
|
|
</IfModule>
|
|
|
|
# Konfigurationsdateien schützen
|
|
<Files "mail-config.php">
|
|
Order allow,deny
|
|
Deny from all
|
|
</Files>
|
|
|
|
<Files "composer.json">
|
|
Order allow,deny
|
|
Deny from all
|
|
</Files>
|
|
|
|
<Files "composer.lock">
|
|
Order allow,deny
|
|
Deny from all
|
|
</Files>
|
|
|
|
# Logs-Verzeichnis schützen
|
|
<Directory "logs">
|
|
Order allow,deny
|
|
Deny from all
|
|
</Directory>
|
|
|
|
# Vendor-Verzeichnis schützen
|
|
<Directory "vendor">
|
|
Order allow,deny
|
|
Deny from all
|
|
</Directory>
|
|
|
|
# Cache-Header für statische Dateien
|
|
<IfModule mod_expires.c>
|
|
ExpiresActive On
|
|
ExpiresByType text/css "access plus 1 month"
|
|
ExpiresByType application/javascript "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 image/gif "access plus 1 month"
|
|
ExpiresByType image/svg+xml "access plus 1 month"
|
|
ExpiresByType image/webp "access plus 1 month"
|
|
ExpiresByType font/woff "access plus 1 month"
|
|
ExpiresByType font/woff2 "access plus 1 month"
|
|
</IfModule>
|
|
|
|
# Gzip-Kompression
|
|
<IfModule mod_deflate.c>
|
|
AddOutputFilterByType DEFLATE text/plain
|
|
AddOutputFilterByType DEFLATE text/html
|
|
AddOutputFilterByType DEFLATE text/xml
|
|
AddOutputFilterByType DEFLATE text/css
|
|
AddOutputFilterByType DEFLATE application/xml
|
|
AddOutputFilterByType DEFLATE application/xhtml+xml
|
|
AddOutputFilterByType DEFLATE application/rss+xml
|
|
AddOutputFilterByType DEFLATE application/javascript
|
|
AddOutputFilterByType DEFLATE application/x-javascript
|
|
</IfModule>
|
|
|
|
# PHP-Einstellungen
|
|
<IfModule mod_php.c>
|
|
php_value upload_max_filesize 10M
|
|
php_value post_max_size 10M
|
|
php_value max_execution_time 30
|
|
php_value memory_limit 128M
|
|
</IfModule>
|
|
|
|
# Fehlerbehandlung
|
|
ErrorDocument 404 /404.html
|
|
ErrorDocument 500 /500.html
|
|
|
|
# Verzeichnis-Listing deaktivieren
|
|
Options -Indexes
|
|
|
|
# Datei-Zugriff beschränken
|
|
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak)$">
|
|
Order Allow,Deny
|
|
Deny from all
|
|
</FilesMatch> |