Return to Snippet

Revision: 67063
at August 6, 2014 17:45 by dmkim


Initial Code
$url = $_SERVER['PHP_SELF'];

$url_parts = parse_url($url);
 
   $new_url = $url_parts['scheme'].'://'.$url_parts['host'].$url_parts['path'];
 
   if (isset($url_parts['query'])) {
 
      parse_str($url_parts['query'], $query_arguments);
      $f = create_function('$a','return $a==\'page\';');
      $query_arguments = array_flip(array_filter(array_flip($query_arguments), $f));
 
     $new_url .= '?'.http_build_query($query_argumenys);
 
   }

Initial URL

                                

Initial Description
Remove all arguments from query string in URL except one

Initial Title
Remove all arguments from query string in URL except one

Initial Tags

                                

Initial Language
PHP