I use user-provided content to generate URLs.
One of my URL had for title Kikar Habusiness - émission du 2/12/12
, which converted to the URL /url/Kikar+Habusiness+-+émission+du+2%2F12%2F12
.
It goes to a 404. If I remove the %2F
from the URL it works fine.
An interesting thing is that my php code (using Yii) usually handles 404 with custom pages, but this one returns a default Apache 404. Which leads me to believe it doesn't even reach my bootstrap file.
The .htaccess reads:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
My Yii parseUrl reads:
public function parseUrl($manager, $request, $pathInfo, $rawPathInfo) {
if(preg_match('%^url/(\d+)%',$pathInfo,$matches)){
$_GET['id'] = $matches[1];
return 'url/view';
}
else if(preg_match('%^category/(\d+)%',$pathInfo,$matches)){
$_GET['id'] = $matches[1];
return 'category/view';
}
return false;
}
My URL slug generator is:
public static function slug($title){
$title = ToolBox::trim($title,60,false);
$title = urlencode($title);
return $title;
}
Note that I cannot have basic ASCII URLs, because some of the content is non-latin (such as Hebrew or Arabic).