Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

In reading through this article:

In Subfolder & File Names, Use Dashes, Not Underscores Good:

Good: http://www.domain.com/sub-folder/file-name.htm

Bad: http://www.domain.com/sub_folder/file_name.htm

In my URL's, I may have one or two city names, ending with the province/state: Burnaby_New_Westminister-BC/[some search term].

My URL rules currently are defined such that everything after the dash is the prov/state.

Some geographic locations already contain dashes: Notre-Dame-de-Grâce (in QC), which I would convert to ~/Notre_Dame_de_Grace-QC/

I thought of placing the prov/state after another "/", however in some cases the province/state name may not exist, thus ~/Notre_Dame_de_Grace/, so the first term after the domain name contains the geo location {city, city_name-state}.

I am now revisiting this, and wondering if this rule set should change, and if so, what is the recommended way of implementing this?

-- UPDATE --

After reviewing this video, I see that I should be using the dashes, rather than underscores. However since I still want to have my geo locations in the first URL section, is there anything wrong with using a double-dash separator - ie: /city-name--state/ ?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Holy cow! Do not over think SEO please. It is not that complicated. I read this article some time ago and I did not take it too seriously. It is not junk mind you, just take with a healthy dose of salt. There is some value to the article of course. I just think the author has missed the mark on this point.

As far as hyphens and underscores, back in my heavy coding days, we did not distinguish between separators, instead we blindly used the word boundaries of the system/language we were using. Word boundaries are not recognition of actual words, but a mechanism by which values can be extracted from strings. In the case of your example, hyphens and underscores, both are word boundaries in any system or language that likely are ignored equally. If a regular expression is used instead of a natural word boundary, then the result would be the same.

As far as a personal recommendation. I would use what you think is best. Using underscores makes the words stand out better to the human eye. But this is a URL. Is this really important? I do not think so. But you make that distinction for yourself. I use hyphens. The primary reason is that it is consistent and seems to be the standard naturally determined by web developers and web masters. I would not, however, use double-hyphens. I am sure it will not break any ones code, but it may under some circumstances so why take the chance.

As far as SEO is concerned, I doubt seriously that hyphens verses underscores makes any difference at all. There is the theory in using the pipe character | for descriptions of course, but the description only effects click-through rates and not SEO per se. Even then, the pipe character I think does nothing at all.

You will notice that the author gives theories tied to programming habits, but does not give metrics or evidence to validate the statement. Even then, I did recognize what he was saying and had to smile. On some level, he is right about coding habits. But to return to what I said before, it is highly likely that a regular expression is used and any URL is split by word boundaries using \b or \B which is a regex anchor that represents a word boundary. Even if this mechanism is not used, then a character class would likely be used that includes most if not all non-word characters including the hyphen and underscore therefore making this theory kinda ridiculous. To code so that an hyphen and underscore are not equal, requires significant and deliberate work that adds bloat and inefficiency. Just a quick hint about programmers. They are lazy... code wise- so I am sure this is not the case.

share|improve this answer

If the state or province is always a two letter abbreviation I wouldn't think you would need to differentiate it with a different type of separator.

Burnaby-New-Westminister-BC/good-food

could be parsed with the regular expression:

([^\/]+)\-([A-Za-z]{2})\/(.*)

Where:

  • $1: City
  • $2: State or province
  • $3: Search term

It should be easy enough to implement in either rewrite rules or code.

share|improve this answer
    
A two-letter prov/state is not guaranteed. I added some in-line refactoring to ensure both the city and states only contain one dash, then separate by two dashes. –  ElHaix May 30 at 19:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.