1
votes

need to remove all $_GET params from address bar - set by facebook etc - except my own id and title

something like:

if(isset($_GET['any-key-except-id-or-title'])){
    header('location: my-native-url');
}
1

1 Answers

2
votes

Loop through $_GET and remove any elements with another key. Then use http_build_query() to create a query string based on the remainder.

foreach (array_keys($_GET)) as $key) {
    if ($key != 'id' && $key != 'title') {
        unset($_GET[$key]);
    }
}

header('Location: my-native-url?' . http_build_query($_GET));