Clean URLs
Clean URLs (or semantic URLs) are readable URLs for websites or web services that intuitively represent the underlying resource.
This typically means:
Omitting implementation details for the underlying web-server. The URL should not contain suffixes like
.phporjspthat denote the underlying technology stack.Putting key information in the path of the URL. Clean URLs only use the query string for ephemeral details, like tracking information. A user visiting the same URL without the query string should be taken to the same resource. This is why some browsers offer to "copy clean link": they strip the tracking parameters from the query string, and the link still opens the same page.
Avoiding opaque IDs. Clean URLs use human-readable slugs, which are often generated by stripping the page title of punctuation, converting it to lower case, and replacing spaces and punctuation with '-' characters.
An example of a clean URL is:
www.allrecipes.com/recipe/slow-cooker-oats/Notice how a lot of information can be gleaned about the meaning of the URL, since the slug ("slow-cooker-oats") is human-readable. Contrast this with the following MSDN URL:
https://msdn.microsoft.com/en-us/library/ms752838(v=vs.85).aspxThis URL tells us about the server software being used, but nothing about the contents of the page.
Advantages of Clean URLs
- Clean URLs do not leak server information.
- Clean URLs are less fragile, since they are explicitly mapped to an underlying resource.
- Clean URLs are SEO friendly.
- Clean URLs are generally more memorable (they have an intuitive meaning when viewed in browser history or when read aloud).
- Clean URLs suggest an organization of data, making site navigation easier.