One hint might be found in perl regular expressions. Check out his webmaster hangout for the full explanation. Im trying to use an underscore in a link in my answers at stackoverlow. It emphasizes the page name with capitalization, and the underscore seems like a clearer and more intuitive worddelimiter than the hyphen. Wed like to clarify the things that matter when making a choice so you can avoid making a bad decision. The biggest danger for hyphens is that the same character typically is also used for subtraction and numerical negation ie.
It would be great if the standards document expressed a clear opinion on how multiple words should be concatenated in url path segments. Most agree that hyphens or underscores are the best punctuation to use in urls. As nouns the difference between underscore and dash is that underscore is an underline. However, dealing with underscore and hypens is still complicated. If youre displaying a full url as a link, underscores become a huge usability problem. As you can see, a layman cannot recognize the underscore used in the second url. Hyphens and underscores in file names dan madden medium. 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.
The link that you provided explains how to structure url if you have hierarchy of entities. So much so i had originally made that the default url scheme in subtext for friendly urls. Googles support article on seo discusses the use logical. 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.
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. Google views hyphens in urls as word separators while an underscore in your url will not be. I was talking with someone recently who thought that no matter how long the url is, keep it hyphen or underscore free. An underscore, on the other hand, is considered a word joiner. What should be preferred in urls dash or underscore. 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. Urls should not use underscores, spaces, or any other characters to separate words. I just tried the same site in firefox and clicking on the navigation link for forms and support shows this url in.
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. 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. As of 2012, dashes are still the best way to optimize your seo urls. No real aesthetic reason, just a matter of efficiency. Then you should know the difference between dash and underscore in seo. Since so many people have complained about it, i will in this description show you the difference between a hyphen and an underscore. Use hyphens to separate the words in url instead of using other symbols such as underscores.
From implementation point of view there is not so much difference. In all actuallity the url is given little weight in the search engine algo. I was an underscore guy until just a couple of months ago. As evident, a layman cannot recognize the underscore used in the second url. You dont want address bars to scroll horizontally or url only links to linewrap. Straight from the horses mouth dash not underscore. Link with underscore does not work meta stack exchange.
I dont agree, and have been doing underscores, but i think i will do hyphens now. Is there any reason why forward slash should be used instead of hyphen. For example, if youre searching for information about aviation, a url like. At the same time, some other shopping carts dont have such structure e. Hyphens are short little lines used to connect two or more words that work together as a. Sharepoint found the word with a space in the url, even if there was a space or underscore. They seem to only make sense at the end of a url to separate words in the title of an article. When a search engine looks at a url for keywords, unlike hyphens between words, underscores are not treated as spaces that separate keywords. How to delete hyphen and underscore from url string in nginx. Capture and match zero or more nonslash characters. Most business owners are not sure which way to go, here are some guidelines to help. Google has traditionally considered the underscore as a true character and not a separator. Matt quickly corrected this perception on his blog, but the belief persisted.
Either way it makes the url less of a headache to read if itissuperlong dot com. Spaces inside of a url or a linked file basically generate a faulty. Complete url optimization details can be found here. Will urldashes, minus or hyphen affect ranking in search results. Using a hyphen is one less keystroke than underscore or camel case no shift necessary. Dashes will tend to work with word wrapping when they need to, in a logical place, whereas if you use underscores.
I often get asked whether id recommend dashes or underscores for words in urls. Id add as part of the guess that programmers use the dash as subtraction so underscore is used. Theyre great for human readability, but theyre remarkably inconvenient in computer resource locators. Web browsers can deal with it fine in most circumstances. All the shopping carts have a friendly urlstrtucure e.
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. The hyphen is still better, as i see it, but by a slim margin. However, the link does not work in the resulting html. The hyphenunderscore translation works only if youre running the new router. At the same time, some other shopping carts dont have such structure, for e. Is it better to use underscores or dashes in a url. This is a small, tiny, miniscule thing, but often the game is won in the trenches of minutia. When you double click windows highlights that part of the name only which is more expediant than a clickdrag. Although urls can include id numbers and codes, the best practice is to use words that. In fact, john mueller explicitly advises against redirecting urls just to resolve the underscore vs.
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. All the shopping carts have a friendly url structure, for e. Do a search for underscore and it will show lots of results. Seo benefits of using hyphensdashes over underscores. A filename with spaces has to be surrounded by quotes when referenced at the command line. A user would like to download a directory of files to their desktop. They seem to be treated as a space where an underscore is not. A sites url structure should be as simple as possible. Discussion in search engine optimization started by rahul pandit, aug 27, 2014. When necessary for readability, use hyphens to separate words. I used to think the choice of using dashes vs underscores to separate words in an url was simply a matter of personal preference.
Jump in the bunker, fire away, and get the victory. I made a booboo recently and ended up with space characters in a huge number or urls, they. Google views hyphens in urls as word separators while an underscore in your url will not be recognized. Which keyword separator is better in url dash or underscore. But if you use a mouse or trackpad for computing, the hyphen is a gamechanger. Also, the only uppercase letters i care to have in my code are commented section titles. As verbs the difference between underscore and dash is that underscore is to underline. I use underscore because its easy to read low visual profile and its easy to rename specific components i. Underscore in url gets escaped to %5f and does not work. I am optimizing a website that has underscores in url.
1473 1254 1281 1422 910 138 932 1072 1318 1093 1510 884 1391 1299 401 7 915 831 69 329 504 701 336 505 661 1178 52 116 1053 461 646 706 582 1489 856 1338 691 406 712