Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter cyrillic url routing
#1

[eluser]0v3rth3d4wn[/eluser]
Hi! I'm having the following problem. I want to use cyrillic symbols in the url. Actually CI is allowing me to use them for a parameter, but not for routing.

On my previous project my config was:
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%&.:_\-абвгдежзийклмнопрстуфхцчшщьъюя';
And everything was working fine and I was able to do this:
Code:
$route['контакт'] = "contact";

But now I can't do it. It gives me an 404 page when using the same configs. The weird thing is that I can use cyrillic chars for method attributes, but I can't route them right now. I read in the forum that I should encode them. So this is working:
Code:
$route[urlencode('контакт')] = "contact";

But this is silly. So I tried encode them in the config file and did this:

Code:
$cyrillic = array('а','б','в','г','д','е','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ь','ъ','ю','я');
function enc(&$item)
{
$item = urlencode($item);
};
array_walk($cyrillic,'enc');
$config['permitted_uri_chars'] = 'a-z 0-9~%&.:_\-'.implode('',$cyrillic);

When I echo the imploded $cyrillic array it returns the encoded chars but my routing is still not working. Am I doing this right?

Thank you in advance!
#2

[eluser]Unknown[/eluser]
1. Search in /system/core/URI.php
Code:
"]+$|i"
2. Replace on
Code:
"]+$|ui"
3. config.php
Code:
$config['permitted_uri_chars'] = 'a-zа-яё 0-9~%.:_\-';
#3

[eluser]0v3rth3d4wn[/eluser]
Thanks for the reply, but this is not working for me. I'm still getting 404 page. It is weird because it isn't the "Unallowed chars error".




Theme © iAndrew 2016 - Forum software by © MyBB