- Clean URL
-
Clean URLs, RESTful URLs or user-friendly URLs are purely structural URLs that do not contain a query string and instead contain only the path of the resource (after the scheme [e.g. http] and the authority [e.g. example.org]). This is often done for aesthetic, usability, or search engine optimization (SEO) purposes.[1] Other reasons for designing a clean URL structure for a website or web service include ensuring that individual resources remain under the same URL for years, which makes the World Wide Web a more stable and useful system,[2] and to make them memorable, logical, easy to type, human-centric, and long-lived.[3]
Contents
Examples
Examples of "clean" versus "unclean" URLs follow:
Unclean URL Clean URL http://example.com/index.php?page=foo http://example.com/foo http://example.com/index.php?page=consulting/marketing http://example.com/consulting/marketing http://example.com/products?category=2&pid=25 http://example.com/products/2/25 http://example.com/cgi-bin/feed.cgi?feed=news&frm=rss http://example.com/news.rss http://example.com/services/index.jsp?category=legal&id=patents http://example.com/services/legal/patents http://example.com/kb/index.php?cat=8&id=41 http://example.com/kb/customer%20intelligence/sales%20forecasting http://example.com/index.php?mod=profiles&id=193 http://example.com/user/john-doe http://example.com/app/dashboard/dsptchr_c80.dll?page=38661&mod1=bnr_ant&UID=4511681&SESSID=4fd8b561ac867195fba2cc5679&... http://example.com/app/dashboard/reports#monthly Reasoning and common practices
The most often cited reasons for using clean URLs is for search engine optimization, but clean URLs can also greatly improve usability and accessibility. Removing unnecessary parts, simplifies URLs and makes them easier to type and remember.[4]
But there can also be different levels of cleanness. It is usually recommended[by whom?] for usability and SEO purposes to make URLs descriptive; so when planning the structure of clean URLs, webmasters often take this opportunity to include relevant keywords in the URL and remove irrelevant words from it. So common words like "the", "and", "an", "a", etc. are often stripped out to further trim down the URL while descriptive keywords are added to increase user-friendliness and improve search engine ranking.[1] This includes replacing hard-to-remember numerical IDs with the name of the resource it refers to. And, because not all resources have URL-friendly names due to the character set restrictions on web URLs or length, it is common practice to generate a slug that is truncated to a certain length and has any invalid characters replaced with human-readable characters. This also eliminates ugly and hard to remember URL-encoded strings (e.g. Peanut%20M%26Ms becomes Peanut_MMs).
Similarly, it is common practice to replace cryptic variable names and parameters with friendly names or to simply do away with them altogether. Shorter URLs that don't contain any esoteric abbreviations or complex syntax that is alien to the average user are less intimidating and contribute to overall usability.
Another aspect of clean URLs is that they do not contain implementation details of the underlying web application.[4] For example, many URLs include the filename of a server-side script, such as "example.php", "example.asp" or "cgi-bin". Such details are irrelevant to the user and do not serve to identify the content, and make it harder to change the implementation of the server at a later date. For example, if a script at "example.php" is rewritten in Python, the URL will have to change, or rewrite rules will need to be used to allow the old URL to redirect to the new one.
See also
References
- ^ a b Opitz, Pascal (2006-02-28). "Clean URLs for better search engine ranking". Content with Style. http://www.contentwithstyle.co.uk/content/clean-urls-for-a-better-search-engine-ranking. Retrieved 2010-09-09.
- ^ Berners-Lee, Tim (1998). "Cool URIs don't change". Style Guide for online hypertext. W3C. http://www.w3.org/Provider/Style/URI.html. Retrieved 6 March 2011.
- ^ Neath, Kyle (2010). "URL Design". http://warpspire.com/posts/url-design/. Retrieved 6 March 2011.
- ^ a b Jacek, Jonas (2011). "Clean URL Design - Guidelines". http://rield.com/how-to/url-design. Retrieved 6 March 2011.
Categories:
Wikimedia Foundation. 2010.