diff --git a/public/.htaccess b/public/.htaccess index 9a8456d..24acb99 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -40,3 +40,16 @@ RewriteRule ^(.+?)/?$ $1.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}/index.php -f 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] diff --git a/public/_errors/.htaccess b/public/_errors/.htaccess new file mode 100644 index 0000000..42931f9 --- /dev/null +++ b/public/_errors/.htaccess @@ -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] \ No newline at end of file diff --git a/public/_errors/404.php b/public/_errors/404.php new file mode 100644 index 0000000..df7d81a --- /dev/null +++ b/public/_errors/404.php @@ -0,0 +1,40 @@ + +
+
+ + Seite nicht gefunden + +

+ 404 +

+

+ Die angeforderte Seite wurde nicht gefunden. +

+ + Zurück zur Startseite + +
+
+