php header() ile istediğiniz yapabilirsin.

Örnek:

header("Location:https://site.com/$_SERVER['REQUEST_URI']", true, 301);

bu kod işini görecektir.