This is possible when you create different subdomains.
If you set up a subdomain in your DNS-settings like 'server2.address.lol', you can redirect everything for that subdomain to another IP-address and so to another server.
you just have to create an A-record.
After you set this up, you can redirect to the PHP-file on that subdomain. Example: http://server2.example.lol/script.php