. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fig\Http\Message\StatusCodeInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use function redirect; use function route; /** * Redirect URLs created by webtrees 1.x (and PhpGedView). */ class RedirectIndividualPhp implements RequestHandlerInterface { /** * @param ServerRequestInterface $request * * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { $tree = $request->getQueryParams()['ged'] ?? ''; $xref = $request->getQueryParams()['pid'] ?? ''; $route = route('individual', ['tree' => $tree, 'xref' => $xref]); return redirect($route, StatusCodeInterface::STATUS_MOVED_PERMANENTLY); } }