'']; $path = '/user/' . $account->id() . $matches[2]; } } // Rewrite community/ to forum/. $path = preg_replace('@^/community(.*)@', '/forum$1', $path); if ($path == '/url-alter-test/bar') { $path = '/url-alter-test/foo'; } return $path; } }