- What are friendly URLs?
- What is your purpose?
- When is it recommended to use friendly URLs instead of regular URLs?
- Is it related to performance?
They are easier to read than URLs or URIs . They use the folder structure commonly used to indicate content, including the parameters used to reach that particular content.
It is the opposite of the normal access of parameterized content that uses own mechanisms of passage of the parameter, generally working with identifier codes. The URL gets "dirty" and does not identify the content.
It has several purposes.
This technique hides the implementation details and normalizes the way to access. Because it is common to use a REST technique, it is easier for the more technical user to tailor the URL to access other content they want. This is not so easy either. More experienced users of this site to a greater or lesser extent know how to do this, but almost all of the other users do not know, and look who are good technical users.
It's an abstraction technique . If the actual implementation is never exposed to users, the developer can change the internal way of manipulating the URLs without affecting the outside operation of the site. This is probably the most important reason for this technique. The rest is minor.
There can be security gains by doing this. But not only by applying the technique is all safe, you need others together.
This is done with a URL redirect technique on the web server or in the application itself (which many people do not know, and that can give more control).
It is often used to shorten URL .
Other times it is a way to consistently normalize address .
Another technique is persistence of address using Persistent uniform resource locator .
In the background is a URL that has more semantics . And then the URL can get even bigger.
Friendly URL is easier to read by the human who best identifies what is there. In general it describes the content with opposing words, or with addition, of an access code.
Look up at your browser now. You have a friendly URL. It has the question ID and its title in a simplified way. You can tap the eye there and find out what this browser flap is about without seeing the contents of it.
It can help in many ways. Including having a sense of what it's all about before you click when it gets the URL from somewhere. When you have it in the bookmark of it. Including the browser autocomplete.
Obviously, if the user is forced to type every semantic URL, it can become a burden. And there are websites that enforce this. Others make the short form optional
It's easier to identify content in logs .
Much easier, is not it?
This descriptive portion quoted above is usually called slug .
But you have to be careful because the title (or other information that is used to give more semantics) is not stable information. You have to use techniques for the content exchange situation and keep access to old assets consistent.
It can also help SEO too. It gives extra information for search engines to index the content. Not that it helps so much.
You have to use it when you master the subject. Like everything else, if it is to do nonsense, do not do it. Go on the rice with beans that earns more.
Do not expect a revolution to use. In general programmers use it because everyone uses it, because they've heard it's good or because they think it's cute. Of course there is some advantage, but most do not know why. And why it may vary according to the type of project.
Otherwise the use should be when you need to facilitate access and abstract the real address of the resource to be accessed.
As all there are advantages and disadvantages. I see a lot of website that does not use the correct technique and has more problems than solutions, or they create even less friendly URLs.
Their performance tends to be slightly worse, after all it needs to make a conversion to the "correct" but imperceptible URL, it's an irrelevant difference in most cases.
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://pt.stackoverflow.com?qid=128341 => https://pt.stackoverflow.com/questions/128341/o-que-são-urls-amigáveis
Interesting article on the subject . If everyone read, it would do a lot less barking with that.
A friendly url is one that is perceptible by humans and contains a description of the content it serves.
A non-friendly url would be like this, for example:
A friendly url would be
Now both can serve the same content, however the second example is more semantic, better in terms of SEO because it has important words to describe the content; and perceptible for humans. While the first example does not tell me anything, nor does it allow me to guess anything about its content.
The non-friendly url was common at the beginning of the web, at the beginning of the CMS, where the content was managed by a database and each page had an ID, that is used in the url. Nowadays much importance is given, for the reasons already described for readability.
In terms of performance is indifferent. Regarding the question "When is it recommended to use friendly URLs within normal URLs?" I would say friendly urls are normal urls. Only in specific cases of product numbers or offline applications do I use numeric, non-friendly urls.
Friendly URL is an URL that is easier to understand, both for search engines and for people who access your site.
For a URL to be friendly, we should understand what the page is about as soon as we look at it.
This would be an example of a good URL: