What is the difference between URL and URI
What is the difference between URL and URI? This article will introduce to you what URL and URI are respectively? What is the use? Let everyone understand the difference between URL and URI, I hope it will be helpful to you.
What is the URL? What is the use?
A URL (Uniform Resource Locator) is the address of a resource on the Internet and can be defined as a string that refers to an address and is used to indicate the location of the resource and the protocol used to access it.
URL is the most commonly used way of locating a resource on the web, providing a way to retrieve a representation of a physical location by describing its network location or primary access mechanism.
The protocol is described in the URL that is used to retrieve the resource and resource name. If the resource is a web type resource, the URL contains http/https at the beginning. Likewise, if the resource is a file, it starts with ftp, if the resource is an email address, it starts with mailto.
URL contains the following information:
1. The protocol used to access the resource
2. The location of the server (either by IP address or domain name )
3. Port number on the server (optional)
4. The location of the resource in the server directory structure
5. Fragment identifier (optional)
Example:
As shown in the figure above, the first part is used for the protocol, and the rest of the part is used for resources consisting of domain names or program names.
What is URI? What is the use?
A URI (Uniform Resource Identifier) is a sequence of characters that identifies a logical or physical resource. Similar to a URL, it is also a string of characters. Identify resources on the Internet by using location, name, or both; it allows for uniform identification of resources.
There are two types of URIs, Uniform Resource Identifier (URL) and Uniform Resource Name (URN).
The general form of any URI is:
scheme:[// [user:password @] host [:port]] [/] path [?查询] [#片段]
Scheme (scheme ): The scheme lists the specific syntax and URI any relevant agreements. The scheme is case-insensitive and is followed by a colon. Ideally, the URI scheme should be registered with the Internet Assigned Numbers Authority (IANA), but non-registered schemes can also be used.
Permission component: The permission component consists of multiple parts: an optional authentication part, a host (consisting of a registered name or IP address), and an optional port number. The authentication part contains the username and password, separated by a colon, followed by the at (@) symbol. After @ is the hostname, then a colon, then a port number. It is important to note that IPv4 addresses must be in dotted decimal notation, and IPv6 addresses must be enclosed in parentheses.
Query (optional) : The query contains a string of non-hierarchical data. Although the syntax is not clearly defined, it is usually a sequence of attribute-value pairs separated by a delimiter, such as an ampersand or a semicolon. The query is separated from the previous part by a question mark.
Fragment (optional) : The fragment contains a fragment identifier that provides direction to the secondary resource.
The main difference between URL and URI
URL is a Uniform Resource Locator, used to identify resources; URI (Uniform Resource Identifier ) provides a simpler and extensible way of identifying resources. URL is a subset of URI. Let's take a look at the main difference between URL and URI.
1. Differences in functions
URL (Uniform Resource Locator) is mainly used to link to web pages, web components or programs on web pages, with the help of access methods (http, ftp, mailto and other protocols) to retrieve location resources.
URI (Uniform Resource Identifier) is used to define the identity of an item, where the word identifier means to distinguish one resource from other resources regardless of the method used (URL or URN).
2. It can be said that a URL is a URI (URL is a subset of URI), but a URI can never be a URL.
3. Protocol difference
URL specifies the protocol type to be used, while URI does not involve protocol specifications.
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
The above is the detailed content of What is the difference between URL and URI. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The reason for the error is NameResolutionError(self.host,self,e)frome, which is an exception type in the urllib3 library. The reason for this error is that DNS resolution failed, that is, the host name or IP address attempted to be resolved cannot be found. This may be caused by the entered URL address being incorrect or the DNS server being temporarily unavailable. How to solve this error There may be several ways to solve this error: Check whether the entered URL address is correct and make sure it is accessible Make sure the DNS server is available, you can try using the "ping" command on the command line to test whether the DNS server is available Try accessing the website using the IP address instead of the hostname if behind a proxy

PHP function introduction—get_headers(): Overview of obtaining the response header information of the URL: In PHP development, we often need to obtain the response header information of the web page or remote resource. The PHP function get_headers() can easily obtain the response header information of the target URL and return it in the form of an array. This article will introduce the usage of get_headers() function and provide some related code examples. Usage of get_headers() function: get_header

Differences: 1. Different definitions, url is a uniform resource locator, and html is a hypertext markup language; 2. There can be many urls in an html, but only one html page can exist in a url; 3. html refers to is a web page, and url refers to the website address.

Nowadays, many Windows users who love games have entered the Steam client and can search, download and play any good games. However, many users' profiles may have the exact same name, making it difficult to find a profile or even link a Steam profile to other third-party accounts or join Steam forums to share content. The profile is assigned a unique 17-digit id, which remains the same and cannot be changed by the user at any time, whereas the username or custom URL can. Regardless, some users don't know their Steamid, and it's important to know this. If you don't know how to find your account's Steamid, don't panic. In this article

Use url to encode and decode the class java.net.URLDecoder.decode(url, decoding format) decoder.decoding method for encoding and decoding. Convert into an ordinary string, URLEncoder.decode(url, encoding format) turns the ordinary string into a string in the specified format packagecom.zixue.springbootmybatis.test;importjava.io.UnsupportedEncodingException;importjava.net.URLDecoder;importjava.net. URLEncoder

Scrapy is a powerful Python crawler framework that can be used to obtain large amounts of data from the Internet. However, when developing Scrapy, we often encounter the problem of crawling duplicate URLs, which wastes a lot of time and resources and affects efficiency. This article will introduce some Scrapy optimization techniques to reduce the crawling of duplicate URLs and improve the efficiency of Scrapy crawlers. 1. Use the start_urls and allowed_domains attributes in the Scrapy crawler to

Preface In some cases, the prefixes in the service controller are consistent. For example, the prefix of all URLs is /context-path/api/v1, and a unified prefix needs to be added to some URLs. The conceivable solution is to modify the context-path of the service and add api/v1 to the context-path. Modifying the global prefix can solve the above problem, but there are disadvantages. If the URL has multiple prefixes, for example, some URLs require prefixes. If it is api/v2, it cannot be distinguished. If you do not want to add api/v1 to some static resources in the service, it cannot be distinguished. The following uses custom annotations to uniformly add certain URL prefixes. one,

Note: The root and aliasroot instructions in location only set the search root to the directory set by root, that is, the uri will not be truncated. Instead, the original uri will be used to jump to the directory to find the file. The aias instruction will truncate the matching uri, and then Use the path set by alias plus the remaining uri as a sub-path to find the uri of proxy_pass in location. If the url of proxy_pass does not have uri, if the tail is "/", the matching uri will be truncated. If the tail is not "/", then Will not truncate the matching uri if the proxy_pass url contains uri
