Qqwy
Qqwy

Reputation: 5649

Permalinks: Why are hypens(-) used over underscores(_) to replace spaces(and other unwanted characters)?

In some large websystems I have come across lately, friendly permalinks, e.g. part of a HTML path that is based on a (often user-specified) string rather than a numerical number, spaces(and other unwanted/disallowed characters that would otherwise need to be url-escaped) are replaced by hyphens (-), and not by underscores (_).

An example: in the URL http://example.com/blog/this-is-my-first-post, this-is-my-first-post is a friendly permalink. Using underscores, this would be http://example.com/blog/this_is_my_first_post

Is this only a personal preference, or is there a technical reason to use hyphens over underscores?

Hypothetical possibilities I thought of:

What I do know:

Could someone shine some light on this?

Upvotes: 1

Views: 42

Answers (1)

Jason Savell
Jason Savell

Reputation: 73

Google has spoken:

Consider using punctuation in your URLs. The URL http://www.example.com/green-dress.html is much more useful to us than http://www.example.com/greendress.html. We recommend that you use hyphens (-) instead of underscores (_) in your URLs.

https://support.google.com/webmasters/answer/76329?hl=en

Upvotes: 1

Related Questions