mercredi 23 mars 2016

Forcing URL to stay lowercase until it reaches "gclid" (Specific part of URL)

Currently I have a function that allows the Whole URL to be lowercase, using :

$requestUrl = $_SERVER['REQUEST_URI'];
$pattern    = '/([A-Z]+)/';

if(preg_match($pattern, $requestUrl)) {
    $new_url = strtolower($requestUrl);     
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $new_url);
    exit;
}

But I want to be able to tell it where to stop being lowercase, Like when it reaches the google analytics 'gclid'.

e.g of my gclid. Should be a mix of lowercase and uppercase. Is there away to stop the case being altered when we reach the '?'.

?gclid=dnvp7dnq074cfbshtaodqruava

To alter the pattern? "$pattern = '/([A-Z]+)/';"

Ive tried quite a few things.

Any advice is appreciated.




Aucun commentaire:

Enregistrer un commentaire