Skip to content

Instantly share code, notes, and snippets.

@cYbercOsmOnauT
Created June 19, 2015 15:16
Show Gist options
  • Save cYbercOsmOnauT/fe96f224a3c4b0331a09 to your computer and use it in GitHub Desktop.
Save cYbercOsmOnauT/fe96f224a3c4b0331a09 to your computer and use it in GitHub Desktop.
The url params are cleaned by the order they are in the request This gets rid of unneeded 301 redirects
public function expected_url($path = '')
{
$path = empty($path) ? $this->phpbb_root_path : $path;
$params = array();
// Check the params by the order they are in the request
foreach($this->request->variable_names(\phpbb\request\request_interface::GET) AS $get) {
$def = $this->seo_opt['zero_dupe']['redir_def'][$get];
if (($this->request->is_set($get, \phpbb\request\request_interface::GET) && $def['keep']) || !empty($def['force']))
{
$params[$get] = $def['val'];
if (!empty($def['hash']))
{
$params['#'] = $def['hash'];
}
}
}
$this->page_url = append_sid($path . $this->seo_opt['req_file'] . '.' . $this->php_ext, $params, true, 0);
return $this->page_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment