Page 2 of 2
Re: [SEO] MakeURLSafe and the '/' character
Posted: Sun Nov 22, 2009 7:48 pm
by grantg
By my reckoning, if a product name has a dash, it is converted to %252d in the URL. I have now amended my general.php in the lib directory to cater for products with & in the name, I have replaced the & character with 'and'
$val = str_replace("&", "and", $val);
I have also amended the first str_replace function, so that a dash is not converted and is left as a dash. Absolutely no problems at all...yet.
Re: [SEO] MakeURLSafe and the '/' character
Posted: Fri Dec 17, 2010 4:13 am
by hattieuadt
Hepl vietnames
Code: Select all
$val = str_replace("đ", "d", $val);
products " 3 Bước chuyên sâu điều trị
đốm nâu và tàn nhang Omar Sharif Re20 Whiteshift Melano " page not found
Re: [SEO] MakeURLSafe and the '/' character
Posted: Sat Dec 18, 2010 11:00 am
by cumitham
SamX wrote:Thank you!!! to complete this hack for spanish users who wants to add characters like:
á, é, í, ó, ú and ñ
Code: Select all
function MakeURLSafe($val)
{
$val = str_replace("-", "%2d", $val);
$val = str_replace("+", "%2b", $val);
$val = str_replace("+", "%2b", $val);
$val = str_replace("/", "%2f", $val);
/** *Spanish Characters - Start */
$val = str_replace("ñ", "n", $val);
$val = str_replace("á", "a", $val);
$val = str_replace("é", "e", $val);
$val = str_replace("í", "i", $val);
$val = str_replace("ó", "o", $val);
$val = str_replace("ú", "u", $val);
/** *Spanish Characters - End */
$val = urlencode($val);
$val = str_replace("+", "-", $val);
return $val;
}
/**
* Convert an already search engine friendly based string back to the normal text equivalent.
*
* @param string The search engine friendly version of the string.
* @return string The normal textual version of the string.
*/
function MakeURLNormal($val)
{
$val = str_replace("-", " ", $val);
$val = urldecode($val);
$val = str_replace("{47}", "/", $val);
$val = str_replace("%2f", "/", $val);
$val = str_replace("%2e", "/", $val);
$val = str_replace("%2d", "-", $val);
$val = str_replace("%2b", "+", $val);
/** *Spanish Characters - Start */
$val = str_replace("A%F1", "ñ", $val);
$val = str_replace("%E1", "a", $val);
$val = str_replace("%E9", "e", $val);
$val = str_replace("%ED", "i", $val);
$val = str_replace("%F3", "o", $val);
$val = str_replace("%FA", "u", $val);
/** *Spanish Characters - End */
return $val;
}
I register just to thank you for your post. Best wishes for you.

Re: [SEO] MakeURLSafe and the '/' character
Posted: Tue Dec 21, 2010 9:56 am
by hattieuadt
hattieuadt wrote:Hepl vietnames
Code: Select all
$val = str_replace("đ", "d", $val);
products " 3 Bước chuyên sâu điều trị
đốm nâu và tàn nhang Omar Sharif Re20 Whiteshift Melano " page not found
Hepl me!
Re: [SEO] MakeURLSafe and the '/' character
Posted: Sun May 13, 2012 4:48 pm
by prospektas
Hi guys, maybe someone will tell how to replace:
%252f to /
%3A to :
%2C to ,
%252b to +
%3D to =
%29 to )
%28 to (
%252d to -
%21 to !
%3F to ?
Thanks a lot !!!