- The easiest way to have non-accent URLs for Vietnamese titles.
- Supports both XenForo 1 and XenForo 2.
- Open source https://github.com/xfrocks/VietnameseFriendlyLink
- Works everywhere (forums, threads, etc.), with minimal conflict.
Hoặc sửa thẳng trong file php core như ngày xưa cho nhanh
Mở thư mục src\XF\Mvc
Edit file Route.php:
Tìm”
$string = strval($string);
Thêm bên dưới dòng trên đoạn mã sau:
Nếu bạn dùng PHP 5.x
//Url khong dau $hacobi1102 = array ("a" => "á|à|ạ|ả|ã|ă|ắ|ằ|ặ|ẳ|ẵ|â|ấ|ầ|ậ|ẩ|ẫ|Á|À|Ạ|Ả|Ã|Ă|Ắ|Ằ|Ặ|Ẳ|Ẵ|Â|Ấ|Ầ|Ậ|Ẩ|Ẫ","o" => "ó|ò|ọ|ỏ|õ|ô|ố|ồ|ộ|ổ|ỗ|ơ|ớ|ờ|ợ|ở|ỡ|Ó|Ò|Ọ|Ỏ|Õ|Ô|Ố|Ồ|Ộ|Ổ|Ỗ|Ơ|Ớ|Ờ|Ợ|Ở|Ỡ","e" => "é|è|ẹ|ẻ|ẽ|ê|ế|ề|ệ|ể|ễ|É|È|Ẹ|Ẻ|Ẽ|Ê|Ế|Ề|Ệ|Ể|Ễ","u" => "ú|ù|ụ|ủ|ũ|ư|ứ|ừ|ự|ử|ữ|Ú|Ù|Ụ|Ủ|Ũ|Ư|Ứ|Ừ|Ự|Ử|Ữ","i" => "í|ì|ị|ỉ|ĩ|Í|Ì|Ị|Ỉ|Ĩ","y" => "ý|ỳ|ỵ|ỷ|ỹ|Ý|Ỳ|Ỵ|Ỷ|Ỹ","d" => "đ|Đ",); while(list($key,$value) = each($hacobi1102)) { $string = @ereg_replace($value, $key, $string); } //end khong dau
Nếu bạn dùng PHP 7.x
//Url khong dau $hacobi1102 = array( "a" => "Á|À|Ả|Ã|Ạ|Ă|Ắ|Ặ|Ằ|Ẳ|Ẵ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ", "d" => "Đ|đ", "e" => "É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ|é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ", "i" => "Í|Ì|Ỉ|Ĩ|Ị|í|ì|ỉ|ĩ|ị", "o" => "Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ|ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ", "u" => "Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự|ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự", "y" => "Ý|Ỳ|Ỷ|Ỹ|Ỵ|ý|ỳ|ỷ|ỹ|ỵ", ); foreach($hacobi1102 as $replace => $search){ $string = preg_replace("/($search)/i", $replace, $string); } $string = str_replace(" ", "-", $string); //end khong dau