error 404

This commit is contained in:
2025-11-23 03:44:07 +01:00
parent d7aeace4e5
commit f02456f6a2
4 changed files with 59 additions and 0 deletions

View File

@@ -40,3 +40,16 @@ RewriteRule ^(.+?)/?$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}/index.php -f RewriteCond %{REQUEST_FILENAME}/index.php -f
RewriteRule ^(.+?)/?$ $1/index.php [L] RewriteRule ^(.+?)/?$ $1/index.php [L]
###############################################
# 6) Globaler 404-Fallback
# Alles was jetzt noch übrig bleibt → 404-Seite
###############################################
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# systempfade nicht abfangen
RewriteCond %{REQUEST_URI} !^/(assets|uploads|auth|landingpage|_errors)/ [NC]
# interne Weiterleitung auf deine Fehlerseite
RewriteRule ^ _errors/404.php [L]

6
public/_errors/.htaccess Normal file
View File

@@ -0,0 +1,6 @@
RewriteEngine On
# nur PHP in _errors vor direktem Aufruf schützen
RewriteCond %{THE_REQUEST} \s/+_errors/ [NC]
RewriteCond %{REQUEST_URI} \.php$ [NC]
RewriteRule ^ - [R=404,L]

40
public/_errors/404.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
// public/_errors/404.php
require __DIR__ . '/../../config/fileload.php';
// Sprache aus Query oder Default
$lang = $_GET['lang'] ?? 'de';
$lang = in_array($lang, ['de','en','it','fr']) ? $lang : 'de';
// Titel und Navigation für das Layout
$pageTitle = 'Seite nicht gefunden usbcheck.it';
$pageDescription = 'Die angeforderte Seite wurde nicht gefunden.';
$navAnchors = []; // keine Anker auf der 404
tpl('layout_start', 'structure');
?>
<section class="mx-auto max-w-3xl text-center py-20 px-6">
<div class="flex flex-col items-center gap-6">
<!-- 404 Bild -->
<img
src="/_errors/img/404.png"
alt="Seite nicht gefunden"
class="w-40 h-40 sm:w-56 sm:h-56 object-contain opacity-90"
loading="lazy"
>
<h1 class="text-5xl font-heading font-bold text-brand-primary mb-2">
404
</h1>
<p class="text-brand-muted text-lg mb-6">
Die angeforderte Seite wurde nicht gefunden.
</p>
<a href="/?lang=<?= htmlspecialchars($lang) ?>"
class="inline-block rounded-full bg-brand-primary text-brand-bg px-6 py-3 text-sm font-semibold hover:bg-blue-400 transition-colors">
Zurück zur Startseite
</a>
</div>
</section>
<?php
tpl('layout_end', 'structure');

BIN
public/_errors/img/404.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB