0

My url has arabic characters like http://localhost/Mypro/ar/flights/رخيص-هواء-تذاكر-البحرين-إلى-مومباي-بوم-باه and i was route this to a method. When I load this url I've got an error:

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404
localhost
Apache/2.4.39 (Win64) OpenSSL/1.1.1b PHP/7.2.18. 

Can any one help me to fix this issue.

config\route.php

$path = urlencode('الرخيصة من الجو تذاكر - (: وجدت) -to - (: أي) - (: أي) - (: وجدت)');
$route['^(en|ar)/'.$path] = "Seo/viewCities";

config\config.php

$config['permitted_uri_chars'] .= '%D8%A2%D8%A7%D8%A8%D9%BE%D8%AA%D8%AB%D8%AC%DA%86%D8%AD%D8%AE%D8%AF%D8%B0%D8%B1%D8%B2%D8%B3%D8%B4%D8%B5%D8%B6%D8%B7%D8%B8%D8%B9%D8%BA%D9%81%D9%82%DA%A9%DA%AF%D9%84%D9%85%D9%86%D9%88%D9%87%DB%8C%D9%8A%DB%B1%DB%B2%DB%B3%DB%B4%DB%B5%DB%B6%DB%B7%DB%B8%DB%B9%DB%B0';

system\core\uri.php

public function filter_uri(&$str)
    {
        if (!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))
        {
            show_error('The URI you submitted has disallowed characters.', 400);
        }
    }
xiawi
  • 1,772
  • 4
  • 19
  • 21

1 Answers1

0

This piece of code maybe can help

    $string ="العربی (العربی";
    $string=str_replace(")","",$string);
//and u can use other str_replace

    $this->load->helper('text');
    $til = url_title(convert_accented_characters($string), 'dash', true);

//$til your slug for url

this work for me :)

amir.01
  • 115
  • 1
  • 1
  • 8