Not case sensitive URL?

For anyone wondering, this is how I was able to do this:

c::set('routes', array(
    array(
        'pattern' => '(:any)',
        'action'  => function($uid) {

            // Does the url contain uppercase characters?
            if (preg_match("/[A-Z]/", $uid)===1) {
                // Redirect to lowercase url
                go(strtolower($uid));
            } else {
                return site()->visit($uid);
            }

        }
    )
    ));
1 Like