CGridView filtering with lowercase url

Hello,

I’ve added this to index.php to make my urls lowercase:


$url = $_SERVER['REQUEST_URI'];

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


if(preg_match($pattern, $url)) {

    $new_url = strtolower($url);


    Header( 'HTTP/1.1 301 Moved Permanently' );

    Header( 'Location: ' . $new_url );

    exit;

}

Works great, but now CGridView filters and sorting don’t work.

I’ve looked into CGridView file and his ajax but can’t find the right part to fix this. Did anybody encounter a similar problem?

Are you getting any error ?

If you change the complete URL to lowercase… do you use all lowercase in your code too?

For example in the actionAdmin() by default Yii uses something like


$model->attributes = $_GET['Yourmodel'];

where the model has the first letter capitalized… in that case you would get an error in your code at that line.

Hi, thank you for your reply. The problem was, that also the querystring went lowercase. So I’ve chosen to stay just with ‘caseSensitive’=>false in urlManager.