SuperThin 10 Posted October 26 How to get rid of "index.php?" or "index.php/ from URL? URL friendly with Unicode character (I imply Vietnamese characters) have problem, how to change code to resolve. Like this https://nongsankhanhhoa.vn/index.php/Sn-phm-t-nuoi-ong/cPath-30/language-vi . It should be https://nongsankhanhhoa.vn/index.php/San-pham-tu-nuoi-ong/cPath-30/language-vi Quote Share this post Link to post Share on other sites
Drack 47 Posted October 26 Not sur to understand : When I click on I have Sản phẩm từ nuôi ong https://nongsankhanhhoa.vn/index.php/Sn-phm-t-nuoi-ong/cPath-30 https://nongsankhanhhoa.vn/index.php/Sn-phm-t-nuoi-ong/cPath-30/language-en https://nongsankhanhhoa.vn/index.php/Sn-phm-t-nuoi-ong/cPath-30/language-vi The url are correct, no problem on that. 1 Quote Share this post Link to post Share on other sites
Drack 47 Posted October 26 Oups ! Ok I see miss a inside the san. look in Shop/URls this function : getSkipAccents Now if you do want you must change something inside this function. The best is to override this function. Copy the files in Custom/Sites/Shop After, you can change this function like you wish. 1 Quote Share this post Link to post Share on other sites
Patrick 34 Posted October 26 You have another solution is to enter the prodcut name without accent. I do not know if in your language it's important or not. 1 Quote Share this post Link to post Share on other sites
ClicShopping 169 Posted October 27 hello @SuperThin, Could you test (on several specific world) this please and tell me if it work ? in includes/Shop/RewriteUrl.php - change the function by this. In it's work it will be added on next update. I take different work on your website, and seems now ok inside the the url Thank you for your comment @SuperThin /** * Remove url accent * @param $str * @param string $charset * @return null|string|string[] */ protected function getSkipAccents(string $str, string $charset = 'utf-8'): string { if (!extension_loaded('intl')) { throw new Exception('intl module not loaded'); } else { $transliterator = \Transliterator::create('Any-Latin; Latin-ASCII'); $str = $transliterator->transliterate(mb_convert_encoding(htmlspecialchars_decode($str),$charset, 'auto')); } $str = htmlentities($str, ENT_NOQUOTES, $charset); $str = preg_replace('#&([A-za-z])(?:acute|cedil|caron|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str); $str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); $str = preg_replace('#&[^;]+;#', '', $str); $str = preg_replace('/[^A-Za-z0-9\-]/', '', $str); // Removes special chars return $str; } 4 2 Quote Share this post Link to post Share on other sites
SuperThin 10 Posted October 28 On 10/27/2019 at 10:10 AM, ClicShopping said: hello @SuperThin, Could you test (on several specific world) this please and tell me if it work ? in includes/Shop/RewriteUrl.php - change the function by this. In it's work it will be added on next update. I take different work on your website, and seems now ok inside the the url Thank you for your comment @SuperThin /** * Remove url accent * @param $str * @param string $charset * @return null|string|string[] */ protected function getSkipAccents(string $str, string $charset = 'utf-8'): string { if (!extension_loaded('intl')) { throw new Exception('intl module not loaded'); } else { $transliterator = \Transliterator::create('Any-Latin; Latin-ASCII'); $str = $transliterator->transliterate(mb_convert_encoding(htmlspecialchars_decode($str),$charset, 'auto')); } $str = htmlentities($str, ENT_NOQUOTES, $charset); $str = preg_replace('#&([A-za-z])(?:acute|cedil|caron|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str); $str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); $str = preg_replace('#&[^;]+;#', '', $str); $str = preg_replace('/[^A-Za-z0-9\-]/', '', $str); // Removes special chars return $str; } Hahaha, thank you very much when pointing me exactly which function in "Mods" (game) I will borrow "strip special code" from WordPress to rewrite function getSkipAccents because PHP has never been a Unicode native language support. I don't know why? Many guys from Israel, Euro use English only? I am reading https://is.gd/F2BLnq Quote Share this post Link to post Share on other sites
ClicShopping 169 Posted October 28 Included in 3.2111 new release who fix some bug indentified in 3.2110. 4 2 Quote Share this post Link to post Share on other sites
SuperThin 10 Posted October 28 Hooray! protected function removeVNeseAccents ($str){ $unicode = array( 'a'=>'á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ', 'd'=>'đ', 'e'=>'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ', 'i'=>'í|ì|ỉ|ĩ|ị', 'o'=>'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ', 'u'=>'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự', 'y'=>'ý|ỳ|ỷ|ỹ|ỵ', 'A'=>'Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ', 'D'=>'Đ', 'E'=>'É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ', 'I'=>'Í|Ì|Ỉ|Ĩ|Ị', 'O'=>'Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ', 'U'=>'Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự', 'Y'=>'Ý|Ỳ|Ỷ|Ỹ|Ỵ', ); foreach($unicode as $nonUnicode=>$uni){ $str = preg_replace("/($uni)/i", $nonUnicode, $str); } return strtolower($str); } protected function getSkipAccents(string $str, string $charset = 'utf-8'): string { return $this->removeVNeseAccents($str); } Done! 5 Quote Share this post Link to post Share on other sites
Patrick 34 Posted October 28 @SuperThin Nice, look the lastest update on github. I will go and there is an update. You can tell us if it work or not Quote Share this post Link to post Share on other sites
Foster 54 Posted October 28 Nice contribution and update for something not always implemented. Quote Share this post Link to post Share on other sites