# Sperre Angreifer-Netz 24.10.2026 (Vorfall dilohver-suite): TECHOFF SRV LIMITED, 93.123.109.0/24
<RequireAll>
  Require all granted
  Require not ip 93.123.109.0/24
</RequireAll>

# Zusatz-Passwort vor der Verwaltung /admin (29.10.2026, sacpluz/dilohver-gmbh#185).
# Greift erst, wenn die Datei existiert (außerhalb der Webwurzel, legt Sascha an). Not-Aus: Datei umbenennen.
<If "-f '/var/www/vhosts/dilohver.de/droppy-admin-transfer.htpasswd' && %{THE_REQUEST} =~ m#^\S+\s+/(index\.php/?)?admin(/|\?|\s)#">
  AuthType Basic
  AuthName "Verwaltung"
  AuthUserFile /var/www/vhosts/dilohver.de/droppy-admin-transfer.htpasswd
  # IP-Sperre von oben hier wiederholen, sonst ersetzt dieser Block sie für /admin
  <RequireAll>
    Require valid-user
    Require not ip 93.123.109.0/24
  </RequireAll>
</If>

RewriteEngine On

# Repo-Dateien (.github/, .gitignore, .gitleaksignore) nicht ausliefern, Ausnahme .well-known (29.10.2026)
RewriteRule (^|/)\.(?!well-known/) - [F,L]
RewriteRule ^README\.md$ - [F,L]

# Drop (s42transfer) – Apache configuration

# Never serve the library, generated config or data directories.
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^(lib|tests|tools|e2e|docs|\.claude|var-[^/]*)(/|$) - [F,L]
  # curl -T report.pdf https://host/put/  → the file name lands in "name".
  RewriteRule ^put/(.*)$ api.php?action=put&name=$1 [QSA,L]
  # SCIM: a directory would rather not see ".php" in its tenant URL, and the
  # query form also works where PATH_INFO is switched off.
  RewriteRule ^scim/(v2/.*)$ scim.php?path=$1 [QSA,L]
</IfModule>

<IfModule mod_alias.c>
  RedirectMatch 403 ^/(.*/)?(lib|tests|tools|e2e|docs|\.claude|var-[^/]+)(/|$)
</IfModule>

# scim.php/v2/Users – the path after the script name has to reach PHP.
<Files "scim.php">
  AcceptPathInfo On
</Files>

# Large uploads: chunk size adapts to these automatically.
<IfModule mod_php.c>
  php_value upload_max_filesize 64M
  php_value post_max_size 66M
  php_value max_execution_time 300
</IfModule>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  # Style sheets, scripts, fonts and images carry ?v=<version>, so a new
  # release busts the cache by itself.
  <FilesMatch "\.(css|js|woff2|png|svg|webp|jpe?g|ico)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
</IfModule>

# Text assets compress well (the style sheet is 85 KB, 18 KB gzipped). By
# extension only: f.php and api.php stream user files with their own length
# and Range support, and those must reach the client untouched. Pages are
# compressed in PHP (s42_page_start).
<IfModule mod_deflate.c>
  <FilesMatch "\.(css|js|svg|json)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>

# Preserve the previous fallback for unhandled legacy URLs.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
