Zum Inhalt springen
L

Das Video kommt von YouTube: erst beim Abspielen verbindet sich die Seite mit YouTube (Google).

URIs, URLs, and URNs | Difference between URI and URL | URL Explained

The TechCave7:27 232.636 Aufrufe veröffentlicht Auf YouTube

Das Wichtigste aus dem Video

Tipp auf eine Zeit – das Video springt genau dorthin.

Transkriptautomatisch erstellt · 45 Zeilen
Herunterladen
  1. Hey, what's going on guys? It's me again, Eub from the webdev cave. Welcome back to a new video and new step towards the expertise. In this short video, I
  2. will talk about URIs, URLs and your ends because I see a lot of confusion between the three. In fact, I used to confuse between them and they cause me a lot of
  3. headache and I don't want you to go through that. Learning about these three terms and the difference between them can be quite useful on the long run. So
  4. what do these three acronyms stand for and what do they mean? What is the difference between them and why does it matter? Let's start by defining each one
  5. of them. The URI stands for uniform resource identifier and it is a string of characters used to identify a resource on the internet either by
  6. location or by name or both. For example, let's say we want to get to a friend. His name is Flank Sidesmack. Okay, that's not a name but yeah. and
  7. this is his address. To actually do that, we need to use either his name or his address. Think of the URI as using the name or the address to identify the
  8. person we want to get to. And of course, we can use both in the same time. Whether we use just one or both, in both cases, it is a URI. It is a way to
  9. identify the resource. We will come back to the URI later. Now, a URL stands for uniform resource locator and it is pretty self-explanatory, right? It is
  10. also a string of characters, but it refers to just the address, just the location of the resource and it is the most used way to locate resources on the
  11. web. For example, in our case, we can identify our friend by just using his location. A UR instead stands for uniform resource. Can you guess that?
  12. Yeah. Name. Uniform resource name. And now this should be obvious to you. It is the name of the resource. Again, in our case, if we want to locate our friend
  13. using a URN, we will use his name flank sides smack. I really love his name actually. Now, I don't know if you can see it or not. Maybe now you're
  14. wondering about it. And that is if URIs can specify the name and the location of the resource we are looking for. As we said, one of them or both at the same
  15. time. And URLs use just the location while URS indicate just the name. Then technically a URI is either a URL or a UR right therefore every URL and every
  16. URL is a URI right well that's true because back in the mid90s in the creation of web identifiers URIs were split into two classes URIs that specify
  17. the location and those that specify the name. And to avoid the confusion about whether a URI is specifying the name or the location, URIs that specify the
  18. location were called URLs, uniform resource locators. And that's what we use in web browsers actually when we want to get a web page. And URIs that
  19. specify the name were called URN. An identifier that specify both the name and the location is called of course a URI. Since two or more resources can
  20. have the same name, it is ineffective to use URLs to identify and locate resources. Thus, almost all the time, we use URLs to do that. And because we use
  21. URLs most of the time, let's talk about them in a little more detail. In order to allow clients to request resources from servers, HTTP messages need to be
  22. sent to the server holding the URL. You may want to watch my video about the HTTP in the web to see how that happens. Well, how can we send an HTTP message?
  23. We do that by typing the URL in the browser and hitting enter. Let's see how does a URL look like? A URL consists of two required components. The protocol
  24. used to connect and the domain or the IP address to connect to. You can see a URL that has other than these information, but that's optional such as the path
  25. which locate the file or the directory in the server. And you can also see the port and other components that we will see in a few. Let's bring a URL, dissect
  26. it, and explain what each part does. The first part is the protocol we're using, which is of course HTTP or HTTPS. If we are looking for resources on the web, we
  27. can use different protocols. For example, if we want to share files on the internet, we use the FTP protocol. The second part is the domain. The
  28. domain is the name that the domain name server gives to a unique IP address. So, we can use either the name or the IP address. For example, my website.com has
  29. the IP address 111.222.33.444 and the domain in the URL is case insensitive. An optional attribute is
  30. the port and if any, it should be after the domain preceded by a colon. You may wonder what a port is. Simply put, a port is a type of software connection
  31. point used by the TCP IP protocol and the connecting computer. Think of that as two persons want to meet and two parallel walls are between them. Each
  32. wall has the same number of doors as the other one and each door is facing its opposite visav and lead just to it. In order to meet the two persons should
  33. open the same door in each wall. This is the same principle as the port in a URL. By specifying a port number, we are telling the server from which port our
  34. request is coming and from which should be received. By default, every protocol has its default port number. So if we didn't specify the port number, it's
  35. actually the same as using the default and it doesn't appear on the URL. For example, the HTTP default port is 80. If we want to connect to the server via
  36. different port, we should specify that. For example, in this case, we are trying to connect through the port 888. The next part of the URL is the path and it
  37. is optional. This is a familiar concept to anyone who has ever used a computer file system. It looks like this. And this is a way to locate the resource on
  38. the server. There can be other parts which are query strings and fragments. Query strings are a way of passing information from the client to the
  39. server such as entering information in user form input. They are preceded by a question mark and they are encoded as key value pairs delimited by a number
  40. symbol. And this is an example of that. Fragments are always at the end of the URL. You can identify a fragment by the hash symbol before it. They are used as
  41. a way of requesting a portion of a page. Browsers will see the fragment tag anchor in the HTML code and scroll the website down to it. For example, this is
  42. a URL that contains a fragment from the Wikipedia website. To sum up, we've seen that we use URIs, URLs or URNs to identify resources and URIs can specify
  43. the address or the name of the resource or both at the same time. We usually use URLs to identify resources and a URL consists of required components which
  44. are the protocol and the domain and optional ones and they are the port, the path, query strings and fragments. So there you have it. No headaches anymore.
  45. I hope you find this video useful and you've learned something from it. Till the next video, keep learning and of course stay tuned.

Zum Nachlesen