4 ms·
Good URLs are: - Short over long. Consider removing useless words from the url like news.ycombinator.com/tips-for-designing-good-urls - Concise. To the point,
by blauwbilgorgel 14y ago
Good URLs are:
- Short over long. Consider removing useless words from the url like news.ycombinator.com/tips-for-designing-good-urls
- Concise. To the point, describe the page content from the url
- Use lowercase. Generally the best idea, for sharing links and technical issues (Apache is case-sensitive sometimes)
- Consistent. Stay consistent, make a style guide for URL's if necessary
- Conscious of trailing slashes. Stick with trailing slashes or no trailing slashes. Redirect to preferred form.
- Logical. Follow a logical structure, that follows the structure of the site. A good URL might read like a breadcrumb: site.com/category/product-name, this works for silo'ing your content. Other sites (such as news sites or without a category) might benefit more from the shortest url possible.
- Using dashes for spaces. No underscores, + or %20 spaces.
- Not using special chars. Consider replacing é with e and removing any non-alphabet non-number character like: ' " (
- Canonical. There should be only 1 unique URL in a search engines index with a page content. Use canonical or 301's or smart use of URL's to make sure this is the case.
- Degradable. What happens if a user visits example.com/category/product-name/ and then removes the /product-name/ part? The URL-structure should allow for this and example.com/category/ should return content (preferably the category description)
- Timeless. If you have an event and you set the date inside the URL, then after this date has passed, this URL gets less valuable. Either 301 these aged URL's to the current event URL, or make it so your URL's can be "re-used" for future events. Cool URLs don't change.
- Optimized for search. Use a keyword tool, to find out what users might be searching for and use the relevant keywords inside your URL. Keyword in URL is a (minute) ranking factor. Bolded keywords in URLs help discoverability.
- Not using excessive dynamic variables. These will confuse your users and search engines.
- Flat over deep. Hiding content away in many subdirectories can hamper readability and search engine crawling. Avoid example.com/cat/subcat/subsubcat/widgets/green/second-hand/widget-deluxe/reviews
- Extension agnostic. An URL ending in .php, .py, .xml, .htm etc. can be changed to another extension in the future, requiring an update or inconsistency in the URLs.
- Not spammy. Good URL's don't repeat (slight variations of) keywords or (ab)use extensions like .font or .shoe
- Not disclosing technology. There is little reason to add cgi-bin to your URLs (unless you want to confuse your competition). An extension to really avoid is the .exe extension (mapserv.exe?doc=15)
- Non-traversable. When using document IDs all URL's can easily be scanned/traversed in a loop or manually. Including URL's not yet ready/or never meant for publication.
- Secure. Not susceptible to injection, XSS etc.
I'd say URLs are both for humans and machines.
- anonymoushn 14y ago- Timeless. If you have an event and you set the date inside the URL, then after this date has passed, this URL gets less valuable. Either 301 these aged URL's to the current event URL, or make it so your URL's can be "re-used" for future events. Cool URLs don't change. Where does the user go to find the 2008 event, if his post from 2008 has a URL that now points to the 2013 event?
- blauwbilgorgel 14y agoIf relevant, in the archive. A link to https://us.pycon.org https://us.pycon.org from a post dating back to 2008 now redirects to https://us.pycon.org/2013 https://us.pycon.org/2013. But that is on a domain basis. Hypothetical: python.org/pycon could always show the most current event, with a link to an archive, if you'd want to read the announcement page of the 2008 event, for whatever reason. If you use python.org/pycon-2012/ and it gets 1000s of links, then you lose all that if you create a new URL python.org/pycon-2013/. This does depend on the event of course and how bad it is reduced in relevance after its date has passed. Compare: /search-engine-ranking-factors-2010 /search-engine-ranking-factors-2011 /search-engine-ranking-factors-2012 or a catchall: /search-engine-ranking-factors Showing the most current one. An URL like above will collect links from all the years, instead of spreading it out over multiple years. P.S.: If you register pycon2013.org then domain squatters might register pycon2014.org pycon2015.org etc.
- paulnechifor 14y ago>Not using special chars. Consider replacing é with e and removing any non-alphabet non-number character like: ' " ( I disagree with this. Maybe this works in English where some spell naïve with two dots to appear fancy, but in some languages letters with diacritical marks are completely different. Now, with IDNs, people should be moving towards more internationalization, not less. Sorry for the bitterness, but the English alphabet is like IE6.
- eCa 14y agoI'm not a native English speaker, but I still design urls to only contain a-z, 0-9, dot, dash, ?, ; (prefered over &), =, %, and /. No spaces, no umlauts, just the plain latin letters. Why? It's prettier (imho), guaranteed to work everywhere and most people don't expect é, ü, å or ł to appear in urls.