Hi guys,
I'm currently having a problem with my website url.
For example, if the age title is: đường dẫn
By default, the script will remove all the non-latin chars and make the link become:
http://demo.com/ng-dn (with the "đ, ư, ờ, ẫn removed)
Normally, I would implement the following script to make the url become:
http://demo.com/duong-dan
Please assist how can I do this. Otherwise, the url is totally broken for my website. They are meaningless.
Thanks.
I'm currently having a problem with my website url.
For example, if the age title is: đường dẫn
By default, the script will remove all the non-latin chars and make the link become:
http://demo.com/ng-dn (with the "đ, ư, ờ, ẫn removed)
Normally, I would implement the following script to make the url become:
http://demo.com/duong-dan
Code:
<?php
$sContent=str_replace(array("á","à","ả","ã","ạ","ă","ắ","ằ","ẳ","ẵ","ặ","â","ấ","ầ","ẩ","ẫ","ậ"), "a", $sContent);
$sContent=str_replace(array("Á","À","Ả","Ã","Ạ","Ă","Ắ","Ằ","Ẳ","Ẵ","Ặ","Â","Ấ","Ầ","Ẩ","Ẫ","Ậ"), "a", $sContent);
$sContent=str_replace(array("é","è","ẻ","ẽ","ẹ","ê","ế","ề","ể","ễ","ệ"), "e", $sContent);
$sContent=str_replace(array("É","È","Ẻ","Ẽ","Ẹ","Ê","Ế","Ề","Ể","Ễ","Ệ"), "e", $sContent);
$sContent=str_replace(array("í","ì","ỉ","ĩ","ị"), "i", $sContent);
$sContent=str_replace(array("Í","Ì","Ỉ","Ĩ","Ị"), "i", $sContent);
$sContent=str_replace(array("ó","ò","ỏ","õ","ọ","ô","ố","ồ","ổ","ỗ","ộ","ơ","ớ","ờ","ở","ỡ","ợ"), "o", $sContent);
$sContent=str_replace(array("Ó","Ò","Ỏ","Õ","Ọ","Ô","Ố","Ồ","Ổ","Ỗ","Ộ","Ơ","Ớ","Ờ","Ở","Ỡ","Ợ"), "o", $sContent);
$sContent=str_replace(array("ú","ù","ủ","ũ","ụ","ư","ứ","ừ","ử","ữ","ự"), "u", $sContent);
$sContent=str_replace(array("Ú","Ù","Ủ","Ũ","Ụ","Ư","Ứ","Ừ","Ử","Ữ","Ự"), "u", $sContent);
$sContent=str_replace(array("ý","ỳ","ỷ","ỹ","ỵ"), "y", $sContent);
$sContent=str_replace(array("Ý","Ỳ","Ỷ","Ỹ","Ỵ"), "y", $sContent);
$sContent=str_replace("đ", "d", $sContent);
$sContent=str_replace("Đ", "d", $sContent);
?>
Please assist how can I do this. Otherwise, the url is totally broken for my website. They are meaningless.
Thanks.