Querystring support

darren_james

New Member
Mar 2, 2018
4
1
3
47
Hi,

We have Wurlie setup and running for a while. We are trying to pass query strings parameters into the redirects, that we'd like to retain, eg

redirects to:

When we try to do this, the querystring is removed. Does the feature not exist or is it a configuration issue in the .htaccess file?

I've tried testing this on your demo here: https://gourl.us/index.html in case its a config issue at our end but refuses to create the Url.

Thank you
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
Hi,

This would need a minor code change to get working. Also, it'll only work with 'direct' redirect types, although you should be able to work the code into other redirect types as needed.

In:

/url_redirector.php

Find:

PHP:
redirect($shortUrlObj->fullUrl);
Replace with:

PHP:
$params = $_REQUEST;
if(isset($params['url'])) {
    unset($params['url']);
}
$finalUrl = $shortUrlObj->fullUrl;
if(count($params)) {
    // prep the query string to forward
    $paramStr = http_build_query($params);
    
    // if there's already a query string, append it
    if (parse_url($url, PHP_URL_QUERY)) {
        $finalUrl .= '&'.$paramStr;
    }
    // otherwise add it
    else {
        $finalUrl .= '?'.$paramStr;
    }
}
redirect($finalUrl);
Let me know how it goes?

Thanks,
Adam.