What are the risks and drawbacks of implementing IP version-based redirection in PHP?

When implementing IP version-based redirection in PHP, one risk is that it may not accurately detect the user's IP version, leading to incorrect redirection. Additionally, relying solely on IP version for redirection may not be a foolproof method as users can manipulate their IP addresses. It is important to consider these drawbacks and have additional checks in place to ensure accurate redirection.

$ip = $_SERVER['REMOTE_ADDR'];

if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
    // Redirect IPv4 users to a specific page
    header("Location: https://example.com/page-for-ipv4-users.php");
    exit();
} elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
    // Redirect IPv6 users to a different page
    header("Location: https://example.com/page-for-ipv6-users.php");
    exit();
} else {
    // Handle other cases or errors
    echo "Unable to determine IP version.";
}