Clean URL
Clean URLs (also known as user-friendly URLs, pretty URLs, search engine-friendly URLs or RESTful URLs) are web addresses or
Clean URLs also do not contain implementation details of the underlying web application. This carries the benefit of reducing the difficulty of changing the implementation of the resource at a later date. For example, many URLs include the filename of a
Structure
A URL will often comprise a
Original URL | Clean URL |
---|---|
http://example.com/about.html
|
http://example.com/about
|
http://example.com/user.php?id=1
|
http://example.com/user/1
|
http://example.com/index.php?page=name
|
http://example.com/name
|
http://example.com/kb/index.php?cat=1&id=23
|
http://example.com/kb/1/23
|
http://en.wikipedia.org/w/index.php?title=Clean_URL
|
http://en.wikipedia.org/wiki/Clean_URL
|
Implementation
The implementation of clean URLs involves
For search engine optimization purposes, web developers often take this opportunity to include relevant keywords in the URL and remove irrelevant words. Common words that are removed include articles and conjunctions, while descriptive keywords are added to increase user-friendliness and improve search engine rankings.[1]
A
Slug
Some systems define a slug as the part of a URL that identifies a page in
Slugs are typically generated automatically from a page title but can also be entered or altered manually, so that while the page title remains designed for display and human readability, its slug may be optimized for brevity or for consumption by search engines, as well as providing recipients of a shared bare URL with a rough idea of the page's topic. Long page titles may also be truncated to keep the final URL to a reasonable length.
Slugs may be entirely lowercase, with accented characters replaced by letters from the Latin script and whitespace characters replaced by a hyphen or an underscore to avoid being encoded. Punctuation marks are generally removed, and some also remove short, common words such as conjunctions. For example, the title This, That, and the Other! An Outré Collection could have a generated slug of this-that-other-outre-collection
.
Another benefit of URL slugs is the facilitated ability to find a desired page out of a long list of URLs without page titles, such as a minimal list of opened
Should a tool to save web pages locally use the string after the last slash as the default
Websites that make use of slugs include
?taken-by=username
URL parameter.[6][7]See also
- Information architecture
- Permalink
- Persistent uniform resource locator (PURL)
- URL normalization
- URL redirection
- URL shortening
- HTTP referer § Referrer hiding
- Canonical link element
References
- ^ a b c Opitz, Pascal (28 February 2006). "Clean URLs for better search engine ranking". Content with Style. Archived from the original on 6 January 2012. Retrieved 9 September 2010.
- ^ Berners-Lee, Tim (1998). "Cool URIs don't change". Style Guide for online hypertext. W3C. Retrieved 6 March 2011.
- ^ "Uniform Resource Identifier (URI): Generic Syntax". RFC 3986. Internet Engineering Task Force. Retrieved 2 May 2014.
- ^ Slug in the WordPress glossary
- ^ Slug in the Django glossary
- ^ "Question URL slugs based on title". Meta Stack Exchange. 2011-10-10.
- ^ "16 Best Instagram Tricks And Hidden Features You Must Know". Fossbytes. 2017-08-04.