Jump to content

Help with special characters in the url


ryan3477

Recommended Posts

Shortly, i am using OpenRealty but it doesnt SEO friendly urls very well with special characters (turkish in my case)

 

The original lines go on like this :

  $this->page = preg_replace_callback('/{page_link_(.*?)}/is', create_function('$matches', 'global $config; require_once($config[\'basepath\'].\'/include/page_display.inc.php\'); $title = page_display::get_page_title($matches[1]); $title = strtolower(str_replace(" ", $config[\'seo_url_seperator\'], $title)); return $config[\'baseurl\'].\'/page-\'.urlencode($title).\'-\'.$matches[1].\'.html\';'), $this->page);

 

I have tried adding below arrays and using str_replace:

 

			$trchar = array("s", "ü", "i", "ö", "S", "G", "g", "ç", "I", "Ç", "Ö", "Ü");
		$enchar = array("s", "u", "i", "o", "S", "G", "g", "c", "I", "C", "O","U");
		$this->page = preg_replace_callback('/{page_link_(.*?)}/is', create_function('$matches', 'global $config; require_once($config[\'basepath\'].\'/include/page_display.inc.php\'); $title = page_display::get_page_title($matches[1]); $title = strtolower(str_replace($trkar, $enkar, $title)); return $config[\'baseurl\'].\'/page-\'.urlencode($title).\'-\'.$matches[1].\'.html\';'), $this->page);

 

but it doesnt seem to work.. any help would be appreciated thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/194767-help-with-special-characters-in-the-url/
Share on other sites

Have you tried using  urlencode()? I asking about using a & in the url a while ago and was told to use that, worked good for me to fix that issue. Not sure if that will help with your issue, but could try it.

 

http://us2.php.net/manual/en/function.urlencode.php

it already does encode however its just useful for not getting 404's, otherwise it does not help the links being readable or seo friendly..."Te%3Fxt%d" etc etc.. does this look friendly to you ?

 

i gotta convert/replace turkish characters to with the ones from the english alphabet.. it seems like a easy task for someone with a reasonable php knowledge, noone else ?

misread what you wanted apparently. Anyways doesn't open reality use a special htaccess setting that will do this

 

EDIT: not for the replace of characters, but can do that in another manner. For that is not just simply replacing the characters.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.