{"id":55432,"date":"2022-05-24T08:34:05","date_gmt":"2022-05-24T08:34:05","guid":{"rendered":"\/tutorials\/?p=55432"},"modified":"2025-04-28T07:31:02","modified_gmt":"2025-04-28T07:31:02","slug":"uri-vs-url","status":"publish","type":"post","link":"\/in\/tutorials\/uri-vs-url\/","title":{"rendered":"URI vs URL: Differences and When to Use Them"},"content":{"rendered":"<p class=\"wp-block-paragraph\">While often used interchangeably, uniform resource identifiers (URIs) and uniform resource locators (URLs) aren&rsquo;t the same. A URI can be a name, a location, or both, while a URL specifies just the location of a resource.<\/p><p class=\"wp-block-paragraph\">Understanding their differences can help develop your website more effectively. For example, when you create a REST API, you&rsquo;ll know how to use URIs or URLs to identify each resource on the web or improve communication among developers.<\/p><p class=\"wp-block-paragraph\">In this article, we&rsquo;ll explore how URIs and URLs differ and take a closer look at their structure. We will also discuss their use cases, benefits, and drawbacks.<\/p><figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Build-WordPress-Website-in-9%20Steps.pdf\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-69276\" style=\"width:840px;height:auto\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png 2048w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-300x83.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-1536x425.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-150x41.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-768x212.png 768w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>\n\n\n\n\n\n<div class=\"protip\"><div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                   What Is URI\n                <\/p>\n            <\/div>\n            <p class=\"protip__content\">A URI or a uniform resource identifier is a string of characters used to identify a web resource, which can include a name, a location, or both. URIs consist of two types &#8210; Uniform Resource Locators (URLs) for specifying a resource&rsquo;s location and Uniform Resource Names (URNs) for naming a resource without indicating its location.<\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-differences-between-uri-and-url\">Differences Between URI and URL<\/h2><p class=\"wp-block-paragraph\">Here are the key differences between a URI and a URL. We&rsquo;ll dive deeper into each element in the next section.<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>URI<\/strong><\/td><td><strong>URL<\/strong><\/td><\/tr><tr><td>Uniform Resource Identifier<\/td><td>Uniform Resource Locator<\/td><\/tr><tr><td>The superset of a URN and a URL.<\/td><td>The subset of URI.<\/td><\/tr><tr><td>Identifies a resource and differentiates it from others by using a name, location, or both.<\/td><td>Identifies the web address or location of a unique resource.<\/td><\/tr><tr><td>Contains components like a scheme, authority, path, and query.<\/td><td>Has similar components to a URI. Its authority consists of a domain name and port.<\/td><\/tr><tr><td>An example of a URI would be <strong>ISBN 0-476-35557-4<\/strong><\/td><td>An example of a URL would be <strong>https:\/\/hostinger.com<\/strong><\/td><\/tr><tr><td>Usually used in XML, tag library files, and other files, such as JSTL and XSTL.<\/td><td>Mainly used to search web pages on the internet.<\/td><\/tr><tr><td>URI scheme can be a protocol, a specification, or a designation like HTTP, file, or data.<\/td><td>URL scheme is a protocol, such as <a href=\"\/in\/tutorials\/http-vs-https\/\">HTTP and HTTPS<\/a>.<\/td><\/tr><\/tbody><\/table><\/figure><div class=\"wp-block-image\">\n<figure data-wp-context='{\"imageId\":\"6a62f7ac1819f\"}' data-wp-interactive=\"core\/image\" data-wp-key=\"6a62f7ac1819f\" class=\"aligncenter size-full wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"373\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2024\/05\/url-vs-uri.jpg\/public\" alt=\"A visual explaining URL and URI\" class=\"wp-image-110087\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2024\/05\/url-vs-uri.jpg\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2024\/05\/url-vs-uri.jpg\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2024\/05\/url-vs-uri.jpg\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/52\/2024\/05\/url-vs-uri.jpg\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" data-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on--click=\"actions.showLightbox\" data-wp-style--right=\"state.thisImage.buttonRight\" data-wp-style--top=\"state.thisImage.buttonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div><h2 class=\"wp-block-heading\" id=\"h-when-to-use-uri\">When to Use URI<\/h2><p class=\"wp-block-paragraph\">A Uniform Resource Identifier (URI) is a string of characters used to identify or name a resource on the internet. It&rsquo;s a common method for identifying and addressing resources, such as web pages, images, videos, and files, over different protocols like HTTP and FTP.<\/p><p class=\"wp-block-paragraph\">Let&rsquo;s take a closer look at the two types of URIs &#8210; URN and URL.<\/p><p class=\"wp-block-paragraph\"><strong>Uniform Resource Name (URN)<\/strong><\/p><p class=\"wp-block-paragraph\">A URN is a persistent and location-independent identifier designed to permanently identify a resource, regardless of its location. The identifier remains valid even if the resource&rsquo;s data is relocated.<\/p><p class=\"wp-block-paragraph\">URNs use a specific scheme to identify resources. For example, <strong>urn:isbn:0405999832<\/strong> uses the ISBN number to identify a specific book.<\/p><p class=\"wp-block-paragraph\">Every URN consists of at least three components:<\/p><ul class=\"wp-block-list\">\n<li><strong>URN <\/strong>&ndash; each URN uses the prefix <strong>urn:<\/strong> to specify a scheme.<\/li>\n\n\n\n<li><strong>Namespace Identifier (NID) <\/strong>&ndash; registered with the <a href=\"https:\/\/www.iana.org\/\" target=\"_blank\" rel=\"noopener\">Internet Assigned Numbers Authority (IANA)<\/a>, it often includes letters, digits, or a hyphen followed by a colon.<\/li>\n\n\n\n<li><strong>Namespace-Specific String (NSS)<\/strong> &ndash; identifies the resource within the internet. It can include <a href=\"https:\/\/www.ascii-code.com\/\" target=\"_blank\" rel=\"noopener\">ASCII codes<\/a>, digits, punctuation marks, and special characters.<\/li>\n<\/ul><p class=\"wp-block-paragraph\"><strong>Uniform Resource Locator (URL)<\/strong><\/p><p class=\"wp-block-paragraph\">Unlike a URN, a URL isn&rsquo;t always persistent and location-independent since it specifies the path to access a resource, which can change over time. Furthermore, it doesn&rsquo;t follow the URN scheme.<\/p><p class=\"wp-block-paragraph\">The main difference between both identifiers is that a URN specifies only the resource&rsquo;s name, while a URL provides the necessary protocol and path to access the resource&rsquo;s location.<\/p><p class=\"wp-block-paragraph\">In short, all URLs are URIs, but not all URIs are URLs.<\/p><p class=\"wp-block-paragraph\">We&rsquo;ll dive deeper into URL syntax and components in the next section.<\/p><h3 class=\"wp-block-heading\" id=\"h-uri-syntax\">URI Syntax<\/h3><p class=\"wp-block-paragraph\">A uniform resource identifier (URI) syntax defines its structure, allowing a program to understand it. Here&rsquo;s the generic syntax of a URI:<\/p><pre class=\"wp-block-preformatted\">scheme:[\/\/authority]path[?query][#fragment]<\/pre><p class=\"wp-block-paragraph\">Now, let&rsquo;s go over the URI syntax elements.<\/p><p class=\"wp-block-paragraph\"><strong>Scheme<\/strong><\/p><p class=\"wp-block-paragraph\">A scheme is the first component of a URI that defines the addressing system. In some cases, URI schemes are a protocol used to access a resource. Meanwhile, other techniques may not specify any protocol.<\/p><p class=\"wp-block-paragraph\">For example, the <strong>about:<\/strong> scheme is used in web browsers, where the resource is built into the client and not associated with any specific protocol.<\/p><p class=\"wp-block-paragraph\">URI schemes can contain any combination of letters, digits, plus signs, periods, or hyphens followed by a colon. The most common URI schemes include HTTP, HTTPS, FTP, mailto, and file.<\/p><p class=\"wp-block-paragraph\">For example, if the URI is <strong>file:website.com\/pathtofile\/intro.pdf<\/strong>, the scheme name is <strong>file<\/strong>.<\/p><p class=\"wp-block-paragraph\"><strong>Authority Component<\/strong><\/p><p class=\"wp-block-paragraph\">It is an optional component preceded by a double slash and terminated by a slash, a question mark, or a hash symbol. It consists of three sub-components:<\/p><ul class=\"wp-block-list\">\n<li><strong>Userinfo <\/strong>&ndash; includes a username and a password separated by a colon.<\/li>\n\n\n\n<li><strong>Host <\/strong>&ndash; consists of either an <a href=\"\/in\/tutorials\/what-is-ip-address\/\">IP address<\/a> or a registered name. The IP address should be inserted into brackets.<\/li>\n\n\n\n<li><strong>Port <\/strong>&ndash; a protocol for connecting to the server. It is an optional sub-component followed by a colon.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">For instance, the authority component from <strong>file:website.com\/pathtofile\/intro.pdf<\/strong> is <strong>website.com\/<\/strong>.<\/p><p class=\"wp-block-paragraph\"><strong>Path<\/strong><\/p><p class=\"wp-block-paragraph\">The path contains a sequence of data segments that describes the location of a resource in a directory structure. It should be empty or separated by a slash.<\/p><p class=\"wp-block-paragraph\">For example, <strong>telnet:\/\/192.0.2.16:80\/<\/strong> or <strong>foo:\/\/info.example.com?fred<\/strong> is a valid URI with an empty path since there&rsquo;s no indication of the specific resource location.<\/p><p class=\"wp-block-paragraph\"><strong>Query Component<\/strong><\/p><p class=\"wp-block-paragraph\">A query is an optional component preceded by a question mark that contains a query string of non-hierarchical data. It is often a string of<strong> key=value <\/strong>pairs.<\/p><p class=\"wp-block-paragraph\">For example, if the URI is <strong>https:\/\/example.org\/test\/test1?search=test-question#part2<\/strong>, the query component is <strong>search=test-question<\/strong>.<\/p><p class=\"wp-block-paragraph\"><strong>Fragment Component<\/strong><\/p><p class=\"wp-block-paragraph\">This optional component includes a fragment identifier that provides the direction to a secondary resource. It refers to a different section of the primary resource, marked by a hash symbol and ending with a URI.<\/p><p class=\"wp-block-paragraph\">For instance, the fragment component of <strong>https:\/\/example.org\/test\/test1?search=test-question#part2<\/strong> is <strong>part2<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-uri-use-cases\">URI Use Cases<\/h3><p class=\"wp-block-paragraph\">Here are examples of URI use cases:<\/p><p class=\"wp-block-paragraph\"><strong>Audiovisual Works<\/strong><\/p><p class=\"wp-block-paragraph\">The International Standard Audiovisual Number (ISAN) is a serial code number used to identify audiovisual works and versions, like films, television programs, or documentaries. Using the <strong>urn:<\/strong> scheme, URIs can identify ISAN without requiring a protocol or a way to access it.<\/p><p class=\"wp-block-paragraph\">For instance, <strong>urn:isan:0000-0004-87D7-0000-Q-0000-0000-6<\/strong> refers to the Avengers: Endgame movie. It uses an audiovisual number to identify a resource without disclosing its location to the user.<\/p><p class=\"wp-block-paragraph\"><strong>Telephone Numbers<\/strong><\/p><p class=\"wp-block-paragraph\">A URI can identify a resource using a dial string, including a <a href=\"https:\/\/www.lawinsider.com\/dictionary\/network-termination-point-ntp\" target=\"_blank\" rel=\"noopener\">network termination point (NTP)<\/a> with the call routing information. The <strong>tel:<\/strong> scheme is only a Globally Unique Identifier (GUID) and doesn&rsquo;t refer to any physical device.<\/p><p class=\"wp-block-paragraph\">For example, <strong>tel:+1-816-555-6666<\/strong> describes a GUID as the standard telephone number in the U.S.<\/p><p class=\"wp-block-paragraph\"><strong>Remote Access<\/strong><\/p><p class=\"wp-block-paragraph\">Telnet is a network protocol where URIs are used to specify access to a remote computer or host via the internet. For example, <strong>telnet:\/\/192.0.2.16:80\/<\/strong> connects to <strong>192.0.2.16<\/strong> on port 80.<\/p><p class=\"wp-block-paragraph\">Telnet is commonly used to test or troubleshoot web or mail servers remotely.<\/p><h2 class=\"wp-block-heading\" id=\"h-when-to-use-url\">When to Use URL<\/h2><p class=\"wp-block-paragraph\">A <a href=\"\/in\/tutorials\/what-is-a-url\/\">Uniform Resource Locator (URL)<\/a> specifies how to access a resource on the internet by describing its primary access mechanism, usually the network location. It may include the protocol (like HTTP or FTP) and the resource&rsquo;s address.<\/p><p class=\"wp-block-paragraph\">URLs let you locate all kinds of online content, such as web pages, images, and videos. Incorporating keywords into them can boost web pages&rsquo; search visibility, benefitting your site&rsquo;s <a href=\"\/in\/tutorials\/what-is-seo\/\">search engine optimization (SEO)<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-url-syntax\">URL Syntax<\/h3><p class=\"wp-block-paragraph\">A URL is a specific type of URI that follows the same syntax structure. Therefore, all URLs conform to the rules set out for URIs but include additional information pinpointing a resource&rsquo;s location.<\/p><p class=\"wp-block-paragraph\">Here&rsquo;s an example of URL syntax:<\/p><pre class=\"wp-block-preformatted\">https:\/\/www.example.com\/forum\/questions\/?tag=networking&amp;order=newest#top<\/pre><p class=\"wp-block-paragraph\">Let&rsquo;s take a look at URL syntax components.<\/p><p class=\"wp-block-paragraph\"><strong>Scheme<\/strong><\/p><p class=\"wp-block-paragraph\">Scheme refers to the protocol used to retrieve a resource. A URL scheme provides the type of application your device uses to open a URL. For example, FaceTime uses the URL scheme <strong>facetime:\/\/<\/strong> to make calls.<\/p><p class=\"wp-block-paragraph\">Here are some of the most common protocols for URL schemes:<\/p><ul class=\"wp-block-list\">\n<li><strong>Hypertext transfer protocol (HTTP)<\/strong> &ndash; allows users to access data from web pages using hypertext links.<\/li>\n\n\n\n<li><strong>Hypertext transfer protocol secure (HTTPS)<\/strong> &ndash; protects data transmission between the user&rsquo;s browser and site.<\/li>\n\n\n\n<li><a href=\"\/in\/tutorials\/what-is-ftp\/\">File transfer protocol (FTP)<\/a> &ndash; transfers files between different devices via a network.<\/li>\n<\/ul><p class=\"wp-block-paragraph\">Some URL protocols use a mailto link to identify email addresses or a <a href=\"https:\/\/www.javatpoint.com\/java-jdbc\" target=\"_blank\" rel=\"noopener\">Java Database Connectivity (JDBC)<\/a> to specify database access based on the user&rsquo;s requirements.<\/p><p class=\"wp-block-paragraph\"><strong>Authority<\/strong><\/p><p class=\"wp-block-paragraph\">Preceded by a double slash, the authority component has two sub-components &ndash; the domain name and, optionally, a port.<\/p><p class=\"wp-block-paragraph\">The <a href=\"\/in\/tutorials\/what-is-a-domain-name\/\">domain name is<\/a> the resource&rsquo;s registered name, such as <strong>hostinger.com<\/strong> or <strong>google.com<\/strong>.<\/p><p class=\"wp-block-paragraph\">Meanwhile, the port is a numerical value that identifies the web service you&rsquo;re requesting on a <a href=\"\/in\/tutorials\/what-is-a-web-server\/\">web server<\/a>. For example, web servers usually use port 80 for HTTP connections and port 443 for HTTPS connections. URLs often omit them since most web browsers default to standard ports.<\/p><p class=\"wp-block-paragraph\"><strong>Path<\/strong><\/p><p class=\"wp-block-paragraph\">This element identifies the specific location of a web page, a post, or other files that users want to access within the domain name. A path also contains any asset file extension, such as images and documents.<\/p><p class=\"wp-block-paragraph\">However, not all URLs show the path component. In modern web servers, path components may be omitted to shorten URLs. Some examples of paths are <strong>&hellip;\/software\/htp\/index.html<\/strong> or <strong>&hellip;\/forum\/question\/<\/strong>.<\/p><p class=\"wp-block-paragraph\"><strong>Query String<\/strong><\/p><p class=\"wp-block-paragraph\">Preceded by a question mark, this string provides data on the web server resource. It usually contains a key and value pairs separated by an ampersand. For example, <strong>?tag=networking&amp;order=newest<\/strong>.<\/p><p class=\"wp-block-paragraph\">A query string stores data as the HTTP protocol is <a href=\"https:\/\/ecomputernotes.com\/jsp\/session\/stateless-protocol\" target=\"_blank\" rel=\"noopener\">stateless<\/a>, making each request independent of the previous one. Therefore, the browser-server connection closes automatically after the client request ends.<\/p><p class=\"wp-block-paragraph\">Also known as URL query parameters, these strings can serve various purposes, such as filtering search results on a webpage. This functionality helps users navigate and access specific content within a resource, such as finding products in an online store.<\/p><p class=\"wp-block-paragraph\"><strong>Fragment Identifiers<\/strong><\/p><p class=\"wp-block-paragraph\">A fragment identifier or an anchor usually appears at the end of a URL, introduced by a hash sign. It&rsquo;s an optional component to direct a web browser to a secondary resource, referring to a specific section within a web page.<\/p><p class=\"wp-block-paragraph\">In an HTML page, the browser jumps to the section tagged by a fragment. For example, if the URL is <strong>https:\/\/example.com\/results.html#intro<\/strong>, it will directly go to the tagged <strong>intro <\/strong>on the page named <strong>results.html<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-url-use-cases\">URL Use Cases<\/h3><p class=\"wp-block-paragraph\">The following are examples of URL use cases:<\/p><p class=\"wp-block-paragraph\"><strong>Email Addresses<\/strong><\/p><p class=\"wp-block-paragraph\">A URL can specify an email address using the <strong>mailto:<\/strong> scheme, such as <strong>mailto:abc@example.com<\/strong>. It provides a hyperlink to send an email directly from an HTML page.<\/p><p class=\"wp-block-paragraph\"><strong>Web Pages<\/strong><\/p><p class=\"wp-block-paragraph\">The most commonly used URLs specify web addresses. Often referred to as an absolute URL, this URL format includes a protocol, a domain name, and a path.<\/p><p class=\"wp-block-paragraph\">For example, <strong>https:\/\/www.example.com\/news\/business\/<\/strong> states the protocol, domain name, and directory path. It directly points users to a specific website section.<\/p><p class=\"wp-block-paragraph\"><strong>Redirects<\/strong><\/p><p class=\"wp-block-paragraph\">Redirecting an outdated resource to a new location is another common use of URLs, especially when moving a webpage.<\/p><p class=\"wp-block-paragraph\">For example, if you changed your website address from <strong>https:\/\/www.blog.example.com<\/strong> to <strong>https:\/\/www.example.com\/blog<\/strong>, you could implement a 301 redirect. Doing so will prevent your visitors from getting various <a href=\"\/in\/tutorials\/http-status-codes\/\">HTTP status codes<\/a>, like a 404 error page.<\/p><p class=\"wp-block-paragraph\"><strong>Internal Pages<\/strong><\/p><p class=\"wp-block-paragraph\">URLs can appear without a protocol and domain name, only specifying the path. They link a particular file within the same domain, often referred to as a relative URL.<\/p><p class=\"wp-block-paragraph\">For example, the relative URL of <strong>https:\/\/www.example.com\/news\/business\/<\/strong> is <strong>\/news\/business\/<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p class=\"wp-block-paragraph\">Understanding the difference between URI and URL helps you manage digital assets and design web services more effectively.<\/p><p class=\"wp-block-paragraph\">A URI stands for a uniform resource identifier, a character string that generally identifies a resource by a name, location, or both on the internet. It can differentiate types of files and other internet resources.<\/p><p class=\"wp-block-paragraph\">On the other hand, a URL or uniform resource locator is a string of characters that shows the resource&rsquo;s address and how to access it on the web page. As URL is a part of a URI, they follow a similar structure.<\/p><p class=\"wp-block-paragraph\">We hope this article helped you understand the difference between URL and URI and when to use them. If you have any questions, check out the FAQ section or leave a comment below.<\/p><h2 class=\"wp-block-heading\" id=\"h-uri-vs-url-faqs\">URI vs URL FAQs<\/h2><p class=\"wp-block-paragraph\">This section answers some of the most common questions about URI vs URL.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1715875113149\"><h3 class=\"schema-faq-question\">What Is an Example URI vs URL?<\/h3> <p class=\"schema-faq-answer\">An example of a URI is <strong>https:\/\/www.example.com\/index.html#date<\/strong>, which identifies a specific resource with the <strong>#date<\/strong> fragment identifier. On the other hand, the URL, indicating the resource&rsquo;s location, is <strong>https:\/\/www.example.com\/index.html<\/strong>.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1715875119451\"><h3 class=\"schema-faq-question\">How Are URIs and URLs Related?<\/h3> <p class=\"schema-faq-answer\">URLs are a specific type of URI. URIs cover a broader range of identifiers, including URLs and URNs. Both URLs and URIs identify resources. The difference is that URLs specify the exact location of a resource on the internet for direct access, whereas URNs provide a location-independent identifier.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>While often used interchangeably, uniform resource identifiers (URIs) and uniform resource locators (URLs) aren&rsquo;t the same. A URI can be a name, a location, or both, while a URL specifies just the location of a resource. Understanding their differences can help develop your website more effectively. For example, when you create a REST API, you&rsquo;ll [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/in\/tutorials\/uri-vs-url\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":115,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":"","footnotes":""},"categories":[22627],"tags":[],"class_list":["post-55432","post","type-post","status-publish","format-standard","hentry","category-domains"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/uri-vs-url\/","default":1},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/uri-e-url\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/uri-vs-url\/","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/uri-vs-url\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/perbedaan-uri-vs-url\/","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/uri-vs-url\/","default":0},{"locale":"it-IT","link":"https:\/\/www.hostinger.com\/it\/tutorial\/uri-vs-url\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/uri-vs-url-differences-and-when-to-use-them\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/uri-vs-url-differences-and-when-to-use-them\/","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/uri-vs-url\/","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/uri-vs-url\/","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/uri-vs-url\/","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/uri-vs-url\/","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/uri-vs-url\/","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/uri-vs-url\/","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/uri-vs-url\/","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/uri-vs-url\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/uri-e-url\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/55432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/comments?post=55432"}],"version-history":[{"count":37,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/55432\/revisions"}],"predecessor-version":[{"id":110501,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/55432\/revisions\/110501"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media?parent=55432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/categories?post=55432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/tags?post=55432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}