soissons
(Dejan Svetec0)
July 22, 2012, 3:42pm
1
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?
mdomba
(Maurizio Domba Cerin)
July 23, 2012, 11:16am
2
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.
soissons
(Dejan Svetec0)
July 23, 2012, 10:42pm
3
mdomba:
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.