Welcome Guest, Not a member yet? Register   Sign In
URL_title, special characters, and SEO
#1

[eluser]umbungo[/eluser]
Are there any recommended ways to handle the use of non alpha-numeric characters for use in urls re: SEO in a reversible way??

My situation; I have several (sub)categories with characters such as ()-&, etc, which will be used in URLs. The URLs will also be used to get that information for use again eg. in database.
I had been using url_title() and then using str_replace('-',' ', $from_url), but this loses all non alpha-numeric characters.
Now, i can eliminate some of them such as replacing '&' with 'and'.. but i really do need some of them; notably the dash.. SO, what I am currently doing is to URL encode;
Code:
//url encode
$for_url = str_replace(' ', '-', str_replace('-', '--',$for_text));

//url decode
$for_text_from_url  = str_replace('#', '-', str_replace('-', ' ', str_replace('--','#', $from_url)));

This would mean a category like 'half-life 2' would give a URL of example.com/half--life-2. Would this work OK for SEO etc? ie. google searching 'half-life 2' would pick up that URL optimally? [note: not actual category]

Or, is there a better way of doing this?? There are many categories and subcategories so using an array to convert between urlName=>textName would not be ideal.

Thanks in advance!
#2

[eluser]Hire Codeigniter Developer[/eluser]
I will request you use something half.life.2 so google cosider as three different word rather one word so chance will increase ..current method also true but need to confirm on it.




Theme © iAndrew 2016 - Forum software by © MyBB