I read a lot about url rewriting and SEO aspect of hyphen vs underscore. As you alredy know, hyphen is preferable for space replacement.
Using underscore instead od space is easy - underscore is not part of normal words, so it can be easily removed (replaced with space) before querying a database.
Using hyphen instead od space put question about querying a database. Hyphens can’t be removed (replaced with space) through hyphenated words existence.
What’s the best solution - explicitly store the hyphenated names (“brand-name”) in the database or something else?
That’s what I meant, not to store just value with hyphens. I’m thinking of some other solution, some real-time replacement if possible.
Thank you! Actually, I’m here for many years (8 at least), but I’m not so comfortable writing english and can’t be helpful to other, so I just read.
I didn’t say that hyphen is better then underscore as space replacement, just it’s preferred way according to Google (Webmaster Central Blog, Matt Cutts…) and most od SEO and usability experts. I really agree with you, especially because I have habit of using underscores, but my opinion vs Google opinion…
Also, be sure I have read your great tutorial, there I learnt how to rewrite unlimited key/value pairs!
I alredy knew that, but as everybody talk about hyphen as better choice and no one indicate this issue, I was thinking that I’m missing something, some easy way to solve it.
So, we can say that there are two solutions - using underscores with on the fly replacing or using hyphens and store original and hyphenated values.
Fair enough. IMHO, there is only one VALID solution but that’s my personal preference. I’m just not going to ever be convinced that -'s are better than _'s OR that SEO’s would ever believe that to be the case.
If you’d like, I can move this thread to SitePoint’s SEO forum board so you can get some less biased (and less experienced, IMHO) opinions.
If you want to go from a string with spaces to a string with hyphens you could do it on the fly, however you might as well just store the hyphenated string in the db to save on the extra legwork.
And if you retain the original spaced version that you can always use the one you need. I don’t really understand the issue, perhaps you will need to add a bit more explanation?