Generally, in PHP you can redirect like this:
header("Location:" . $somewhere);
exit;
If you have a file called rd.php you would use code like this:
https://somewhere.com/folder/rd.php?a_param=123
In rd.php
<?php
$param = $_GET['a_param'];
header("Location: https://somewhere_else/?b_param={$param}");
exit;
If you want to implement https://somewhere.com/folder/?a_param=123, meaning you don't want the rd.php part, you will need some help from apache2 or whatever webserver you are using. You can use Apache mod_rewrite to do this.
# Put this in document_root/folder
# .htaccess
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ rd.php [QSA,L]