Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why use - instead off _ in url

Tags:

why use - instead off _ in url? Url contain '_' seems like no bad effects.

like image 423
hamlet Avatar asked Mar 19 '11 15:03

hamlet


People also ask

Should I use hyphen or underscore in URL?

Google recommends using hyphens instead of underscores in your URLs. This is because using hyphens instead of underscores makes it easier for Google's web crawler to compute the information that your website has and create consistent results.

Can you have _ in URL?

If you use dash or underscore, remember that a dash is read by Google as a hyphen, so does not alter how your URL is categorized. An underscore is counted as a character, and can mess up your SEO.

What does underscore mean in URL?

Google views hyphens in URLs as word separators while an underscore in your url will not be recognized. This means using hyphens makes it much easier for Google to figure out what a page is about. For example, a URL containing the phrase "my_page" would be interpreted as "mypage" instead of "my page".

Is underscore allowed in URI?

It is legal, however, to have an underscore in the URI 'path' that follows the domain name part of a URL.


1 Answers

Underscores are not allowed in a host name. Thus some_place.com is not a valid URL because the host name is not valid. Underscores are permissible in URLS. Thus some-place.com/which_place/ is perfectly legitimate, other concerns aside.

From RFC 1738:

host

   [...] Fully qualified domain names take the form as described    in Section 3.5 of RFC 1034 [13] and Section 2.1 of RFC 1123    [5]: a sequence of domain labels separated by ".", each domain    label starting and ending with an alphanumerical character and    possibly also containing "-" characters. The rightmost domain    label will never start with a digit, though, which    syntactically distinguishes all domain names from the IP    addresses. 
like image 173
Don Avatar answered Oct 21 '22 09:10

Don