<?php
$domain = isset($_GET['domain']) && is_string($_GET['domain']) ? $_GET['domain'] : '';
$destination = empty($domain) ? '/whois' : '/whois/?domain=' . $domain;

http_response_code(301);
header('Location: ' . $destination);