When necessary for readability, use hyphens to separate words. Check out his webmaster hangout for the full explanation. At the same time, some other shopping carts dont have such structure, for e. I used to think the choice of using dashes vs underscores to separate words in an url was simply a matter of personal preference.
Web browsers can deal with it fine in most circumstances. Urls should not use underscores, spaces, or any other characters to separate words. Dashes will tend to work with word wrapping when they need to, in a logical place, whereas if you use underscores. Most business owners are not sure which way to go, here are some guidelines to help.
As evident, a layman cannot recognize the underscore used in the second url. Hyphens and underscores in file names dan madden medium. Sharepoint found the word with a space in the url, even if there was a space or underscore. Im only talking about audio files, wav samples, kontakt instruments, etc. I made a booboo recently and ended up with space characters in a huge number or urls, they. Spaces inside of a url or a linked file basically generate a faulty. Straight from the horses mouth dash not underscore. Hyphens are short little lines used to connect two or more words that work together as a. Googles support article on seo discusses the use logical. Link with underscore does not work meta stack exchange. Is it better to use underscores or dashes in a url.
It is clear by now that using an underscore while picking the domain name is bad practice and it looks like using a dash is way. A filename with spaces has to be surrounded by quotes when referenced at the command line. Then you should know the difference between dash and underscore in seo. What you have to remember, though, is that the filename is part of the direct url to that image. They seem to be treated as a space where an underscore is not. Is there any reason why forward slash should be used instead of hyphen. As you can see, a layman cannot recognize the underscore used in the second url. How to delete hyphen and underscore from url string in nginx. As nouns the difference between underscore and dash is that underscore is an underline. So much so i had originally made that the default url scheme in subtext for friendly urls. Since so many people have complained about it, i will in this description show you the difference between a hyphen and an underscore. Urls with a few variables in them can rank better than a searchenginefriendly. From implementation point of view there is not so much difference. A sites url structure should be as simple as possible.
In fact, john mueller explicitly advises against redirecting urls just to resolve the underscore vs. Underscore in url gets escaped to %5f and does not work. The biggest danger for hyphens is that the same character typically is also used for subtraction and numerical negation ie. All the shopping carts have a friendly url structure, for e. As verbs the difference between underscore and dash is that underscore is to underline. They seem to only make sense at the end of a url to separate words in the title of an article. Wed like to clarify the things that matter when making a choice so you can avoid making a bad decision.
It emphasizes the page name with capitalization, and the underscore seems like a clearer and more intuitive worddelimiter than the hyphen. Using a hyphen is one less keystroke than underscore or camel case no shift necessary. I just tried the same site in firefox and clicking on the navigation link for forms and support shows this url in. The hyphen is still better, as i see it, but by a slim margin. Id add as part of the guess that programmers use the dash as subtraction so underscore is used. Google views hyphens in urls as word separators while an underscore in your url will not be. Although urls can include id numbers and codes, the best practice is to use words that. Nothing more than a religious choice personally, i preferred underscores because i felt dashes intruded upon the words while underscores stayed at the bottom out of the way. For example, if youre searching for information about aviation, a url like. A user would like to download a directory of files to their desktop. If youre displaying a full url as a link, underscores become a huge usability problem. However, the link does not work in the resulting html. Jump in the bunker, fire away, and get the victory.
However, dealing with underscore and hypens is still complicated. What should be preferred in urls dash or underscore. When you double click windows highlights that part of the name only which is more expediant than a clickdrag. This is a small, tiny, miniscule thing, but often the game is won in the trenches of minutia. Also, the only uppercase letters i care to have in my code are commented section titles. Most agree that hyphens or underscores are the best punctuation to use in urls.
An underscore, on the other hand, is considered a word joiner. I imagine this is due to being able to reconstitute this back from url rewriting so they know the difference between a dash in the url that replaces a space vs a which would reconstitute back to a dash. It would be great if the standards document expressed a clear opinion on how multiple words should be concatenated in url path segments. In all actuallity the url is given little weight in the search engine algo. The debate over whether to use dashes or underscores to represent spaces in urls is rather heated in the web development community, but not quite as extremely so as that of whether to use tabs or spaces when indenting code. Matt quickly corrected this perception on his blog, but the belief persisted. The link that you provided explains how to structure url if you have hierarchy of entities. Consider organizing your content so that urls are constructed logically and in a manner that is most intelligible to humans when possible, readable words rather than long id numbers. Google has traditionally considered the underscore as a true character and not a separator. You dont want address bars to scroll horizontally or url only links to linewrap. One hint might be found in perl regular expressions. Which keyword separator is better in url dash or underscore. Do a search for underscore and it will show lots of results. I use underscore because its easy to read low visual profile and its easy to rename specific components i.
Capture and match zero or more nonslash characters. Discussion in search engine optimization started by rahul pandit, aug 27, 2014. I dont agree, and have been doing underscores, but i think i will do hyphens now. Use hyphens to separate the words in url instead of using other symbols such as underscores. But if you use a mouse or trackpad for computing, the hyphen is a gamechanger. Here is why fyi, my testing was done with ie 9 first of all, the underscore character is a perfectly acceptable character in a url. I often get asked whether id recommend dashes or underscores for words in urls.
No real aesthetic reason, just a matter of efficiency. Either way it makes the url less of a headache to read if itissuperlong dot com. Google views hyphens in urls as word separators while an underscore in your url will not be recognized. All the shopping carts have a friendly urlstrtucure e. When a search engine looks at a url for keywords, unlike hyphens between words, underscores are not treated as spaces that separate keywords. So if your application is named myapp and you are using the default controller, this url should work also assuming that you are running the web2py on the same machine. Theyre great for human readability, but theyre remarkably inconvenient in computer resource locators. I was an underscore guy until just a couple of months ago. The hyphenunderscore translation works only if youre running the new router. Overly complex urls, especially those containing multiple parameters, can cause a problems for crawlers by creating unnecessarily high numbers of urls that point to identical or similar content on your site.
Im trying to use an underscore in a link in my answers at stackoverlow. I was talking with someone recently who thought that no matter how long the url is, keep it hyphen or underscore free. The tradeoff at that point becomes about readability and reliability vs speed, and id suggest that using loops is an optimization step in most cases where youd want to use a utility library, rather than a good starting point. Seo benefits of using hyphensdashes over underscores. Will urldashes, minus or hyphen affect ranking in search results. I am optimizing a website that has underscores in url.
1602 206 492 676 966 140 820 211 1017 256 494 728 1371 1496 1500 123 790 615 1356 23 1284 1229 461 407 1287 992 1270 876