Reputation:
i have a problem. I hope you can help me. I don’t speak english very well, but i try to explain me good as i can.
I am from argentina, so, i have to work with the “ñ” character. For SEO, i want include the “ñ” at the url for some words, so, for example, i have:
But, when i enter to “www.domain.com/diseñoweb” it doesn’t work. And i need the “ñ” character in the url. Do somebody know how can i do this?
Thank you!
Upvotes: 1
Views: 1691
Reputation: 449395
What you want to do is most likely not going to work as you want, because URLs can't contain non-ASCII characters. See here for background.
I think you need to create a route for the URLencoded version, like so:
$route['dise%c3%b1oweb'] = "webdesign";
if you then enter a URL containing
diseñoweb
a modern browser will automatically URLencode the character.
Upvotes: 3
Reputation: 1635
first, you need to allow that char in your config, for example you can have something like these…
$config['permitted_uri_chars'] = 'a-z 0-9_\-ñ';
Then, at system/core/URI.php, on line 231, replace
if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))
to
if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", utf8_encode($str)))
Upvotes: 2