/** * TIBA (Timo Bahr, 24.10.2026) – Alte /index/-URLs (vor dem Relaunch) 1:1 weiterleiten * * Vorher: wp-root/index/.htaccess hat /index/X pauschal auf /X umgeleitet – vor WordPress und Rank Math. * Folge: Rank-Math-Regeln mit Quelle index/... griffen nie, und viele Ketten endeten auf 404. * Die .htaccess ist deaktiviert (index/.htaccess.tiba-deaktiviert-2026-10-24). * * Jetzt: Erst greift Rank Math mit dem vollen Pfad (index/...). Nur wenn danach ein 404 bleibt, * prüft dieses Snippet den Pfad OHNE /index/: Rank-Math-Regel oder echte Seite -> eine 301 direkt aufs Endziel. * Gibt es kein Gegenstück, bleibt es beim 404 (keine Sammelweiterleitung, siehe Entscheidung 1:1). */ add_action('template_redirect', function () { if (!is_404()) { return; } $path = ltrim((string) parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH), '/'); if (stripos($path, 'index/') !== 0) { return; } $rest = rawurldecode(substr($path, 6)); if ($rest === '') { return; } $target = ''; if (class_exists('\RankMath\Redirections\DB')) { $m = \RankMath\Redirections\DB::match_redirections($rest); if ($m && !empty($m['url_to']) && in_array((int) $m['header_code'], [301, 302, 307, 308], true)) { $target = $m['url_to']; } } if (!$target) { $id = url_to_postid(home_url('/' . $rest)); if ($id && get_post_status($id) === 'publish') { $target = get_permalink($id); } } if ($target) { wp_redirect($target, 301, 'TIBA index-Altlasten'); exit; } }, 99);
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w020ac20/oxycare-gmbh-neu/wp-content/fluent-snippet-storage/23-tiba-alte-index-urls-11.php:24) in /www/htdocs/w020ac20/oxycare-gmbh-neu/wp-includes/pluggable.php on line 1539

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/w020ac20/oxycare-gmbh-neu/wp-content/fluent-snippet-storage/23-tiba-alte-index-urls-11.php:24) in /www/htdocs/w020ac20/oxycare-gmbh-neu/wp-includes/pluggable.php on line 1542