A uniform resource locator (URL), colloquially known as an address on the Web,[1] is a reference to a resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI),[2][3] although many people use the two terms interchangeably.[4][a] URLs occur most commonly to reference web pages (HTTP/HTTPS) but are also used for file transfer (FTP), email (mailto), database access (JDBC), and many other applications.
Most web browsers display the URL of a web page above the page in an address bar. A typical URL could have the form http://www.example.com/index.html, which indicates a protocol (http), a hostname (www.example.com), and a file name (index.html).
History
Uniform Resource Locators were defined in RFC1738 in 1994 by Tim Berners-Lee, the inventor of the World Wide Web, and the URI working group of the Internet Engineering Task Force (IETF),[7] as an outcome of collaboration started at the IETF Living Documents birds of a feather session in 1992.[7][8]
The format combines the pre-existing system of domain names (created in 1985) with file path syntax, where slashes are used to separate directory and filenames. Conventions already existed where server names could be prefixed to complete file paths, preceded by a double slash (//).[9]
Berners-Lee later expressed regret at the use of dots to separate the parts of the domain name within URIs, wishing he had used slashes throughout,[9] and also said that, given the colon following the first component of a URI, the two slashes before the domain name were unnecessary.[10]
Early WorldWideWeb collaborators including Berners-Lee originally proposed the use of UDIs: Universal Document Identifiers. An early (1993) draft of the HTML Specification[11] referred to "Universal" Resource Locators. This was dropped some time between June 1994 (RFC 1630) and October 1994 (draft-ietf-uri-url-08.txt).[12] In his book Weaving the Web, Berners-Lee emphasizes his preference for the original inclusion of "universal" in the expansion rather than the word "uniform", to which it was later changed, and he gives a brief account of the contention that led to the change.
Every HTTP URL conforms to the syntax of a generic URI. The URI generic syntax consists of five components organized hierarchically in order of decreasing significance from left to right:[13]: §3
A component is undefined if it has an associated delimiter and the delimiter does not appear in the URI; the scheme and path components are always defined.[13]: §5.2.1 A component is empty if it has no characters; the scheme component is always non-empty.[13]: §3
The authority component consists of subcomponents:
A non-empty scheme component followed by a colon (:), consisting of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus (+), period (.), or hyphen (-). Although schemes are case-insensitive, the canonical form is lowercase and documents that specify schemes must do so with lowercase letters. Examples of popular schemes include http, https, ftp, mailto, file, data and irc. URI schemes should be registered with the Internet Assigned Numbers Authority (IANA), although non-registered schemes are used in practice.[b]
An optional authority component preceded by two slashes (//), comprising:
An optional userinfo subcomponent followed by an at symbol (@), that may consist of a user name and an optional password preceded by a colon (:). Use of the format username:password in the userinfo subcomponent is deprecated for security reasons. Applications should not render as clear text any data after the first colon (:) found within a userinfo subcomponent unless the data after the colon is the empty string (indicating no password).
A host subcomponent, consisting of either a registered name (including but not limited to a hostname) or an IP address. IPv4 addresses must be in dot-decimal notation, and IPv6 addresses must be enclosed in brackets ([]).[13]: §3.2.2 [c]
An optional port subcomponent preceded by a colon (:), consisting of decimal digits.
A path component, consisting of a sequence of path segments separated by a slash (/). A path is always defined for a URI, though the defined path may be empty (zero length). A segment may also be empty, resulting in two consecutive slashes (//) in the path component. A path component may resemble or map exactly to a file system path but does not always imply a relation to one. If an authority component is defined, then the path component must either be empty or begin with a slash (/). If an authority component is undefined, then the path cannot begin with an empty segment—that is, with two slashes (//)—since the following characters would be interpreted as an authority component.[16]: §3.3
By convention, in http and https URIs, the last part of a path is named pathinfo and it is optional. It is composed by zero or more path segments that do not refer to an existing physical resource name (e.g. a file, an internal module program or an executable program) but to a logical part (e.g. a command or a qualifier part) that has to be passed separately to the first part of the path that identifies an executable module or program managed by a web server; this is often used to select dynamic content (a document, etc.) or to tailor it as requested (see also: CGI and PATH_INFO, etc.).
where: "/questions" is the first part of the path (an executable module or program) and "/3456/my-document" is the second part of the path named pathinfo, which is passed to the executable module or program named "/questions" to select the requested document.
An http or https URI containing a pathinfo part without a query part may also be referred to as a 'clean URL,' whose last part may be a 'slug.'
An optional query component preceded by a question mark (?), consisting of a query string of non-hierarchical data. Its syntax is not well defined, but by convention is most often a sequence of attribute–value pairs separated by a delimiter.
An optional fragment component preceded by a hash (#). The fragment contains a fragment identifier providing direction to a secondary resource, such as a section heading in an article identified by the remainder of the URI. When the primary resource is an HTML document, the fragment is often an id attribute of a specific element, and web browsers will scroll this element into view.
A web browser will usually dereference a URL by performing an HTTP request to the specified host, by default on port number 80. URLs using the https scheme require that requests and responses be made over a secure connection to the website.
Internationalized URL
Internet users are distributed throughout the world using a wide variety of languages and alphabets, and expect to be able to create URLs in their own local alphabets. An Internationalized Resource Identifier (IRI) is a form of URL that includes Unicode characters. All modern browsers support IRIs. The parts of the URL requiring special treatment for different alphabets are the domain name and path.[18][19]
The domain name in the IRI is known as an Internationalized Domain Name (IDN). Web and Internet software automatically convert the domain name into punycode usable by the Domain Name System; for example, the Chinese URL http://例子.卷筒纸 becomes http://xn--fsqu00a.xn--3lr804guic/. The xn-- indicates that the character was not originally ASCII.[20]
The URL path name can also be specified by the user in the local writing system. If not already encoded, it is converted to UTF-8, and any characters not part of the basic URL character set are escaped as hexadecimal using percent-encoding; for example, the Japanese URL http://example.com/引き割り.html becomes http://example.com/%E5%BC%95%E3%81%8D%E5%89%B2%E3%82%8A.html. The target computer decodes the address and displays the page.[18]
Protocol-relative URLs
Protocol-relative links (PRL), also known as protocol-relative URLs (PRURL), are URLs that have no protocol specified. For example, //example.com will use the protocol of the current page, typically HTTP or HTTPS.[21][22]
A URL implies the means to access an indicated resource and is denoted by a protocol or an access mechanism, which is not true of every URI.[5][4] Thus http://www.example.com is a URL, while www.example.com is not.[6]
The procedures for registering new URI schemes were originally defined in 1999 by RFC2717, and are now defined by RFC 7595, published in June 2015.[14]
For URIs relating to resources on the World Wide Web, some web browsers allow .0 portions of dot-decimal notation to be dropped or raw integer IP addresses to be used.[15]
Historic RFC1866 (obsoleted by RFC 2854) encourages CGI authors to support ';' in addition to '&'.[17]: §8.2.1
A URL (Uniform Resource Locator) is the address of a unique resource on the internet. It is one of the key mechanisms used by browsers to retrieve published resources, such as HTML pages, CSS documents, images, and so on.
In theory, each valid URL points to a unique resource. In practice, there are some exceptions, the most common being a URL pointing to a resource that no longer exists or that has moved. As the resource represented by the URL and the URL itself are handled by the Web server, it is up to the owner of the web server to carefully manage that resource and its associated URL.
Any of those URLs can be typed into your browser's address bar to tell it to load the associated resource, which in all three cases is a Web page.
A URL is composed of different parts, some mandatory and others optional. The most important parts are highlighted on the URL below (details are provided in the following sections):
Note: You might think of a URL like a regular postal mail address: the scheme represents the postal service you want to use, the domain name is the city or town, and the port is like the zip code; the path represents the building where your mail should be delivered; the parameters represent extra information such as the number of the apartment in the building; and, finally, the anchor represents the actual person to whom you've addressed your mail.
Note: There are some extra parts and some extra rules regarding URLs, but they are not relevant for regular users or Web developers. Don't worry about this, you don't need to know them to build and use fully functional URLs.
The first part of the URL is the scheme, which indicates the protocol that the browser must use to request the resource (a protocol is a set method for exchanging or transferring data around a computer network). Usually for websites the protocol is HTTPS or HTTP (its unsecured version). Addressing web pages requires one of these two, but browsers also know how to handle other schemes such as mailto: (to open a mail client), so don't be surprised if you see other protocols.
Next follows the authority, which is separated from the scheme by the character pattern ://. If present the authority includes both the domain (e.g., www.example.com) and the port (80), separated by a colon:
The domain indicates which Web server is being requested. Usually this is a domain name, but an IP address may also be used (but this is rare as it is much less convenient).
The port indicates the technical "gate" used to access the resources on the web server. It is usually omitted if the web server uses the standard ports of the HTTP protocol (80 for HTTP and 443 for HTTPS) to grant access to its resources. Otherwise it is mandatory.
Note: The separator between the scheme and authority is ://. The colon separates the scheme from the next part of the URL, while // indicates that the next part of the URL is the authority.
One example of a URL that doesn't use an authority is the mail client (mailto:foobar). It contains a scheme but doesn't use an authority component. Therefore, the colon is not followed by two slashes and only acts as a delimiter between the scheme and mail address.
/path/to/myfile.html is the path to the resource on the Web server. In the early days of the Web, a path like this represented a physical file location on the Web server. Nowadays, it is mostly an abstraction handled by Web servers without any physical reality.
?key1=value1&key2=value2 are extra parameters provided to the Web server. Those parameters are a list of key/value pairs separated with the & symbol. The Web server can use those parameters to do extra stuff before returning the resource. Each Web server has its own rules regarding parameters, and the only reliable way to know if a specific Web server is handling parameters is by asking the Web server owner.
#SomewhereInTheDocument is an anchor to another part of the resource itself. An anchor represents a sort of "bookmark" inside the resource, giving the browser the directions to show the content located at that "bookmarked" spot. On an HTML document, for example, the browser will scroll to the point where the anchor is defined; on a video or audio document, the browser will try to go to the time the anchor represents. It is worth noting that the part after the #, also known as the fragment identifier, is never sent to the server with the request.
Any URL can be typed right inside the browser's address bar to get to the resource behind it. But this is only the tip of the iceberg!
The HTML language (see Structuring content with HTML) makes extensive use of URLs:
to create links to other documents with the <a> element;
to link a document with its related resources through various elements such as <link> or <script>;
to display media such as images (with the <img> element), videos (with the <video> element), sounds and music (with the <audio> element), etc.;
to display other HTML documents with the <iframe> element.
Note: When specifying URLs to load resources as part of a page (such as when using the <script>, <audio>, <img>, <video>, and the like), you should generally only use HTTP and HTTPS URLs, with few exceptions (one notable one being data:; see Data URLs). Using FTP, for example, is not secure and is no longer supported by modern browsers.
Other technologies, such as CSS or JavaScript, use URLs extensively, and these are really the heart of the Web.
What we saw above is called an absolute URL, but there is also something called a relative URL. The URL standard defines both — though it uses the terms absolute URL string and relative URL string, to distinguish them from URL objects (which are in-memory representations of URLs).
Let's examine what the distinction between absolute and relative means in the context of URLs.
The required parts of a URL depend to a great extent on the context in which the URL is used. In your browser's address bar, a URL doesn't have any context, so you must provide a full (or absolute) URL, like the ones we saw above. You don't need to include the protocol (the browser uses HTTP by default) or the port (which is only required when the targeted Web server is using some unusual port), but all the other parts of the URL are necessary.
When a URL is used within a document, such as in an HTML page, things are a bit different. Because the browser already has the document's own URL, it can use this information to fill in the missing parts of any URL available inside that document. We can differentiate between an absolute URL and a relative URL by looking only at the path part of the URL. If the path part of the URL starts with the / character, the browser will fetch that resource from the top root of the server, without reference to the context given by the current document.
Let's look at some examples to make this clearer. Let's assume that the URLs are defined from within the document located at the following URL: https://developer.mozilla.org/en-US/docs/Learn_web_development.
https://developer.mozilla.org/en-US/docs/Learn_web_development itself is an absolute URL. It has all necessary parts needed to locate the resource it points to.
All of the following URLs are relative URLs:
Scheme-relative URL: //developer.mozilla.org/en-US/docs/Learn_web_development — only the protocol is missing. The browser will use the same protocol as the one used to load the document hosting that URL.
Domain-relative URL: /en-US/docs/Learn_web_development — the protocol and the domain name are both missing. The browser will use the same protocol and the same domain name as the one used to load the document hosting that URL.
Sub-resources: Howto/Web_mechanics/What_is_a_URL — the protocol and domain name are missing, and the path doesn't begin with /. The browser will attempt to find the document in a subdirectory of the one containing the current resource. In this case, we really want to reach this URL: https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Web_mechanics/What_is_a_URL.
Going back in the directory tree: ../CSS/display — the protocol and domain name are missing, and the path begins with ... This is inherited from the UNIX file system world — to tell the browser we want to go up by one level. Here we want to reach this URL: https://developer.mozilla.org/en-US/docs/Learn_web_development/../Web/CSS/display, which can be simplified to: https://developer.mozilla.org/en-US/docs/Web/CSS/display.
Anchor-only: #semantic_urls - all parts are missing except the anchor. The browser will use the current document's URL and replace or add the anchor part to it. This is useful when you want to link to a specific part of the current document.
Less common than the URL parts discussed above, you may see a username and password included in URLs.
For example:
https://username:password@www.example.com:80/
When included, the username and password are put between the :// characters and the authority, with a colon between the two and an at sign (@) at the end.
A username and password can be included in the URL when accessing websites that use the HTTP authentication security mechanism, to immediately sign in to a website and bypass the username/password dialog box that would otherwise appear to enter your credentials into.
While you might still see this mechanism used in the wild, it is deprecated because of security concerns, and modern websites tend to use other mechanisms for authentication. See Access using credentials in the URL for more details.
Despite their very technical flavor, URLs represent a human-readable entry point for a website. They can be memorized, and anyone can enter them into a browser's address bar. People are at the core of the Web, and so it is considered best practice to build what is called semantic URLs. Semantic URLs use words with inherent meaning that can be understood by anyone, regardless of their technical know-how.
Linguistic semantics are of course irrelevant to computers. You've probably often seen URLs that look like mashups of random characters. But there are many advantages to creating human-readable URLs:
It is easier for you to manipulate them.
It clarifies things for users in terms of where they are, what they're doing, what they're reading or interacting with on the Web.
Some search engines can use those semantics to improve the classification of the associated pages.
A URL (Uniform Resource Locator, also called a web address) is a unique identifier used to locate a resource on the internet. URLs consist of multiple parts -- including a protocol and domain name -- that tell web browsers how and where to retrieve a resource.End users use URLs by typing them directly into a browser address bar or by clicking a hyperlink found on a webpage, bookmark list, email or another application.
How is a URL structured?
The URL contains the name of the protocol needed to access a resource, as well as a resource name. The first part of a URL identifies what protocol to use as the primary access medium. The second part identifies the IP address or domain name -- and possibly subdomain -- where the resource is located.
URL protocols include HTTP (Hypertext Transfer Protocol) and HTTPS (HTTP Secure) for web resources, mailto for email addresses, FTP for files on a File Transfer Protocol server and telnet for a session to access remote computers. A colon and two forward slashes follow most URL protocols, but only a colon follows the mailto protocol.
URLs can also specify the following optional information after the domain:
A path to a specific page or file within a domain.
A specific reference point within a file, such as a named anchor in an HTML file.
A query or search parameters used -- commonly found in URLs for search results.
Importance of URL design
URLs can only be sent over the internet using the ASCII character set. Because URLs often contain non-ASCII characters, the URL must convert into a valid ASCII format. URL encoding replaces unsafe ASCII characters with a percent sign (%) followed by two hexadecimal digits. URLs cannot contain spaces.
URL examples
When designing URLs, there are different theories about how to make the syntax most usable for readers and archivists. For example, the URL's path can include dates, authors and topics in a section referred to as the slug. Consider the URL for this definition:
https://www.techtarget.com/searchnetworking/definition/URL
Look past the HTTPS protocol and the permalink (www.techtarget.com). The file includes two paths (searchnetworking and definition) and the definition title (URL). Though not present in this example, some URL designers choose to add the date of the post, usually as YYYY/MM/DD.
Parts of a URL
Using the URL https://www.techtarget.com/whatis/search/query?q=URL as an example, components of a URL can include the following:
The protocol or scheme. This is used to access a resource on the internet. Protocols include http, https, ftps, mailto and file. The domain name system name reaches the resource. In this example, the protocol is https.
Host name or domain name. This is the unique reference that represents a webpage. For this example, it is techtarget.com.
Subdomain. This precedes the main domain name. In this case, "www" denotes the Word Wide Web. Other subdomain options include "blog," "mail" and "support."
Port name. These usually aren't visible in URLs, but they're necessary. Ports 80 and 443 are the default ports for web servers, but there are other options. In a URL, ports always follow a colon. For this example, https://www.techtarget.com:443.
Path. A path refers to a file or location on the web server. For this example, the path is whatis/search/query.
Query. Found in the URL of dynamic pages, the query consists of a question mark, followed by parameters or the query string. In this example, "?" marks the beginning of the query.
Parameters. These are pieces of information in a query string of a URL. Multiple parameters can be separated by ampersands (&). In this example, the parameter is "q=URL."
Fragment. This is an internal page reference, which refers to a section within the webpage. It appears at the end of a URL and begins with a pound sign (#). Although not in the example above, an example could be #history in the URL https://en.wikipedia.org/wiki/Internet#History.
Other examples of parts of a URL can include the following:
The URL mailto:president@whitehouse.gov initiates a new email addressed to the mailbox "president" in the whitehouse.gov domain.
The URL ftp://www.companyname.com/whitepapers/widgets.ps specifies FTP use to download a file.
HTTP vs. HTTPS
Computers use both HTTP and HTTPS to retrieve data from web servers to view content in a browser. One difference between them is that HTTPS uses a Secure Sockets Layer certificate to encrypt the end-user and server connection. Another difference is that HTTPS uses TCP/IP port number 443 by default, whereas HTTP uses port 80.
HTTPS is vital to protecting sensitive information -- such as passwords, credit card numbers and identity data -- from unauthorized access.
URL vs. URI
Uniform Resource Identifiers (URIs) are strings of characters used to identify a resource over a network. A URL is the most common type of URI. URLs are essential to navigating the internet.
URL shorteners
URL shortening is a technique to make a URL substantially shorter in length and still direct to the required page. Shorteners use a redirect on a domain name that is short to achieve this.
Many URL shortener services are available. While many are free, those that offer additional capabilities, such as web analytics, cost money. Companies offering URL shorteners include Rebrandly, Bitly, Short.io, TinyURL and Bl.ink.
Some website hosts, such as GoDaddy.com, offer URL shorteners. Other service providers, including search engines, might not offer URL shorteners. This is because they are often subject to abuse by spammers hiding malware inside shortened URLs.
URL history
Data retention related to web usage is a huge privacy concern. Recently, public demand increased for search engine and application service providers to be transparent in what information they collect, retain and sell.
For example, Google Chrome's privacy policy notes that in basic browser mode, the search engine stores information locally on the system. This information includes browsing history and URLs of pages visited. It also stores a cache of text, images and other resources from those pages.
Google also collects and retains data for various lengths of time. Users can delete some data whenever they want. However, Google deletes some data automatically and retains other data for longer periods of time when necessary.
Editor's note: This definition was updated to improve the reader experience.
Continue Reading About What is a URL (Uniform Resource Locator)?
A software-defined networking controller is an application in SDN architecture that manages Flow control for improved network ... See complete definition
Fiber to the home (FTTH) is the installation and use of optical fiber from a central point to individual buildings to provide ... See complete definition
A URL, which stands for Universal Resource Locator, is the unique web address of a website, image, document or any other resource on the web. While URLs are specific types of Uniform Resource Identifiers (URI) most commonly used to reference webpages, they're also use in email communications, file transferring processes and database accessing.
The URL of any webpage can be found in the address bar at the top of the screen of most web browsers (such as Chrome, Safari or Firefox). If you take a look at the address bar of this webpage, for example, you’ll see that its URL is https://www.wix.com/blog/what-is-a-url.
To see the full-form URL of an image or document within a broader webpage, right-click to copy the element’s address and paste it into a new tab or page.
It’s important to keep in mind that while the terms are often used interchangeably, domain names are not the same as URL addresses. While purchasing a domain name allows webpage owners to customize their online address, it's only one component of a URL.
URLs can be accessed in several ways. You can type the URL directly into your browser's address bar to navigate to a specific webpage. Alternatively, you can click on hyperlinks found on webpages, bookmark lists, emails or various applications. These methods offer easy access to online content, ensuring you can quickly find the information you need.
Different parts of a URL
The parts of a URL each of which plays a crucial role in the performance of a site:
Protocol
Otherwise known as “scheme”, the first part of a URL indicates which protocol must be used by the browser to access the resources. The most common protocols include HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure) for web elements and FTP (File Transfer Protocol) to download files.
Subdomain
Sitting at the beginning of the domain, subdomains help navigate and organize the different sections of large sites. They’re most commonly used in websites with a significant amount of content and pages, such as online stores, support platforms and blogs.
Domain
Also referred to as second-level domain or host, this is the actual name of your website and thus the most customizable part of your URL. Together with subdomains and top-level domain extensions, this section completes the definition of domain name.
The final part of a URL is the path, sitting after a slash and used to designate specific pages. This section is often broken down into smaller elements such as subdirectory, file name and parameters. For example, ‘/encyclopedia/definition/__url’ is the path for this webpage’s URL.
Parameter
Parameters in a URL provide additional information to the server about what is being requested, often used to filter or sort data, track sessions or perform other specific functions. They are appended to the end of a URL after a question mark and are usually structured as key-value pairs, separated by an ampersand if there’s more than one.
Anchor
Anchors, also known as fragments, are used in URLs to direct the user to a specific part of a single page. They are introduced by the hash symbol (#) and follow the main part of the URL. Anchors are particularly helpful for navigating long webpages or documents by jumping directly to a relevant section, providing users a more streamlined experience.
What is the difference between an absolute URL and a relative URL?
Choosing between absolute and relative URLs for your website comes down to understanding their purpose and strengths.
An absolute URL includes the full web address, ensuring a complete path to a specific page. For instance, a blog post built on Wix might use an absolute URL like https://www.wix.com/blog/what-is-a-url. This is the complete address, starting with the protocol (https://), followed by the domain (www.wix.com), and the path to the page (/blog/what-is-a-url).
Absolute URLs are great for SEO and external links because they give clear direct paths that search engines and users can easily follow. However, they can be harder to manage for internal links, especially during domain changes or updates.
A relative URL omits the protocol and domain, focusing only on the path to the resource within the website. For example, instead of linking to the absolute URL above you could use /what-is-a-url when internally connecting pages on your Wix website. Relative URLs are shorter and often easier to manage because they adapt automatically if you update your domain. Just be cautious—using them for external links can create broken links if accessed outside your site.
How does a URL work?
URLs (Uniform Resource Locators) identify resources on the internet. A web browser uses the URL given to locate and retrieve the requested web page from the server, displaying it to the user.
Why are URLs important?
URLs (Uniform Resource Locators) are crucial for navigating the internet. They provide a standardized way to access resources, such as web pages, images and videos.
URLs specify the exact location of a resource, enabling browsers to retrieve and display content accurately. They are essential for linking between web pages, facilitating seamless user experiences. Additionally, URLs play a key role in SEO, helping search engines index and rank content. They also enhance usability by allowing users to share and bookmark specific pages easily. Overall, URLs are fundamental to the structure and functionality of the web, ensuring efficient information retrieval and sharing.
Also known as friendly URLs, semantic URLs are composed of logical parts that allow visitors to easily understand which webpage they’re in and where it falls within the site hierarchy. Just like when choosing a domain name, there are a few crucial areas that can be severely impacted by whether or not a site uses semantic URLs:
Usability
Users should be able to navigate a site solely through the address bar, or at the very least, be capable of easily retracing their steps from within it. Complex URLs might deter visitors from extending their stay on the page in favor of alternatives with a better user experience.
SEO
Clear URLs allow search engine crawlers to have a better understanding of the type of page they’re indexing and how it relates to others on the site. As a result, they’re most likely to rank and build stronger site authority. Think of a semantic URL as a way to properly organize your pages in a labeled drawer, rather than throwing all of them into a closet and hoping for the best.
Accessibility
Visitors using screen readers must be able to understand where links are leading to and what kind of information they contain without having to decipher a URL packed with complex strings.
A URL, also known as a web address, is a unique identifier used to locate a resource on the internet. It serves as the bridge between a user and the desired webpage or file. When you type a URL into the address bar of your web browser or click on a hyperlink, the browser uses the URL to retrieve the requested resource.
The structure of a URL
A URL consists of multiple parts that instruct the web browser on how and where to retrieve a resource. Let's break down the structure of a URL:
Protocol: The first part of a URL specifies the protocol for accessing the resource. Common protocols include HTTP (Hypertext Transfer Protocol), HTTPS (HTTP Secure), FTP (File Transfer Protocol), and mailto (for email addresses).
Domain: The domain name or IP address indicates the location of the resource on the internet. A domain can also include subdomains, which further specify the location within a domain.
Path: The path refers to the specific file or location on the web server where the resource is located. It helps the browser navigate to the desired page or file within the domain.
Query parameters: Query parameters pass additional information to the server. They are commonly seen in URLs for search results or dynamic pages. Query parameters are separated by ampersands (&) and are composed of key-value pairs.
Fragment: Fragments are optional components of a URL that specify a specific reference point within a file. HTML files often use them to navigate to a specific section or anchor within a webpage.
HTTP and HTTPS are two protocols used for retrieving web resources. The main difference between them lies in the level of security they provide. HTTP transmits data in plain text, meaning that any information sent between the user's browser and the server can be intercepted and read by unauthorized parties. On the other hand, HTTPS uses a secure sockets layer (SSL) certificate to encrypt the connection, ensuring that sensitive information, such as passwords or credit card numbers, remains secure.
Mailto URLs
Mailto URLs enable users to initiate a new email by clicking on a link. They are commonly used in email signatures or on websites to provide a convenient way for users to contact someone. A mailto URL typically begins with "mailto:" followed by the email address of the recipient.
FTP URLs
FTP (File Transfer Protocol) URLs are used to download files from FTP servers. They are commonly used for accessing large files or transferring files between servers. An FTP URL typically begins with "ftp://" followed by the domain name or IP address of the server and the file path.
FAQs
What is the full meaning of URL?URL stands for uniform resource locator. A URL is nothing more than the address of a given unique resource on the web.What Is an example of a URL address?Paubox’s full URL is https://www.paubox.com/ and typing it in a browser's address bar will lead users to our site. How do I know what my URL is?A uniform resource locator tells the internet where to find the web page you want to see. People don't have URLs - web pages do. The URL for the web page you're reading right now is in the long, rectangular box just underneath the tabs in your browser.See also:HIPAA Compliant Email: The Definitive Guide
What is a URL? FAQ
What's the maximum length a URL can be?
The de facto standard safe limit is 2,000 characters for URLs to work across most browsers and servers.
Browser-specific limits
Internet Explorer: 2,083 characters (with a path length limit of 2,048 characters)
Google Chrome: Up to 32,767 characters (approximately 2MB or 2,097,152 characters in some sources)
Mozilla Firefox: Also supports up to 32,767 characters
While modern browsers can handle longer URLs, it's recommended to keep URLs shorter for compatibility. Server configurations, proxies and other infrastructure may impose their own limits.
Very long URLs can cause issues with:
Server processing
User experience
SEO performance
Caching
Mobile devices
What happens when a URL contains special characters from different languages, like Chinese or Arabic?
How to figure out if your domain name is available?
If your website gets a lot of traffic and ranks high in search engine results, things can get tricky if you need to change the domain or URL. Redirecting a URL during the transition ensures that all visitors to your original website are automatically sent to its new location. You can also use redirects to direct visitors to another page on the same website. This guide will teach you how to redirect a URL to another website or domain, both on the server side (301 and 302 redirects) and the client side (meta refresh redirects, PHP, and JavaScript redirects).
Redirecting a URL to Another Location
To permanently redirect a URL to another location, use a 301 redirect. You can create one in your website's .htaccess file, in cPanel, or using a WordPress plugin.
To redirect a URL temporarily, use a 302 redirect, a meta refresh redirect, PHP redirect, or JavaScript redirect.
If you don't have access to your web server configuration, you can create a meta refresh redirect, PHP redirect, or JavaScript redirect by editing your website's code.
Open the .htaccess file on your web server.If the URL is moving permanently, you can use a 301 redirect to send traffic to a different URL. If you manage your website by editing files manually, you can create your redirect in a file called .htaccess. The file is usually in your website's root directory (typically called public_html, htdocs, or www). Download the file and open it in a text editor like Notepad for Windows or TextEdit for Mac, or edit it directly on the server if you have access to do so.
If there is no .htaccess file, your web server may not be an Apache server. Contact your web host for instructions on creating a redirect.
If the redirect is temporary, you can create a 302 redirect. Just replace 301 in our examples with 302 to indicate that the URL redirection is not permanent.
If your website uses WordPress, you can use this method if you can edit your web server configuration files by hand.
2
Locate (or create) the rewrite engine.To create a redirect, you'll need to enable the rewrite engine in the Apache mod_rewrite engine. If you don’t see the following code, add it to the bottom of the file:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
3
Redirect a single URL.Now that the rewrite engine is enabled, you can add your redirects just below the line "RewriteEngine On." If you only want to redirect a particular page or directory on your website to another location, add a redirect like this:
<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 /oldpage https://example.com/newpage
</IfModule>
"Redirect 301" indicates that we're doing a 301 (permanent) redirect. After that comes the path to the directory on your webserver (or the file) that you're redirecting elsewhere. Last is the URL you're redirecting to.
In the above example, all visitors to the /oldpage directory on the website will be routed to the /newpage directory of example.com.
You can redirect files (e.g., index.html) and directories (e.g., /about/) to local or remote directories. For example, to redirect https://mywebsite.com/oldpage/index.html to https://example.com/newpage/), you'd use Redirect 301 /oldpage/index.html https://example.com/newpage/).
You can also redirect a URL to another file on the same web server—just leave out the domain name on the second part of the redirect. For example, if you changed the name of index.html to home.html, you can redirect Redirect 301 /index.html /home.html.
4
Redirect all URLs on this website to another website (optional).If you are switching domain names and want all traffic to your existing website to go to the new website, you can do so by adding the following line to the bottom of your .htaccess file:
In this example, all hits to this website's domain name will automatically be redirected to the URL https://example.com.
5
Save your changes and reupload the file.Once you've added your redirect, you'll need to place it back into the root directory of your website. If you downloaded the file, do not add a file extension (e.g., txt) when saving the new file.
Test the redirect in a private (incognito) window. Open a new private browsing window and type the old URL into your browser. If you've done everything correctly, it will redirect you to the new site.
Log in to your cPanel account.If you use cPanel to manage your website, you can redirect a URL to another—either a 301 (permanent) or 302 (temporary) redirect—without editing any text files manually.
2
Click the Domains menu.Configuration options for the domains hosted on your account will appear.
3
Click Redirects.Now you'll see the option to redirect an individual page, a domain, or all hosted domains to another URL.
4
Select a redirect type from the menu.If you plan to redirect the URL to the new address permanently, select Permanent (301). If the redirect is only temporary, select Temporary (302).[1]
If a visitor has the page bookmarked, a 301 redirect will automatically update the bookmark to reflect the URL change.
5
Choose a page to redirect.To redirect all hits to all of your hosted domains to another URL, select All Public Domains from the "https://?(www.)?" menu. Otherwise, select the domain name you want to redirect. If you just want to redirect one page on that domain to another URL, enter the path to that page into the "/" field.
For example, if you want to redirect https://example.com/about/home.html to another URL, enter example.com into the first field, and about/home.html into the second.
6
Enter the URL you want to redirect to. In the "Redirects to" field, type the full URL (including https:// or another protocol) into the field.
7
Select a www redirection setting.If you want to redirect traffic to the URL regardless of whether the user types www. before your domain name (e.g., you want to redirect both https://www.example.com and https://example.com), select Redirect with or without www. Otherwise, you can select whether to redirect only when www. is included, or only when it is not.
8
Choose whether to set up a wildcard redirect.If you are in the process of moving your website to a new location and want to redirect hits to all files and directories on the current site to the same structure on the new site, check the box next to "Wild Card Redirect."
For example, all hits to files/directories like https://www.example.com/picture.jpg and https://www.example.com/users/ will redirect to https://www.newdomain.com/picture.jpg and https://www.newdomain.com/users/.
9
Click Add to add your URL redirect.Now that you've added a redirect, you can test it in a new browser tab or window.
It's not possible to edit an existing redirect. If you need to make a change, you must delete the redirect and then recreate it.[2]
To install the plugin, download the ZIP file from the website, unzip it, and upload the redirection directory to your /wp-content/plugins directory.[4]
Once installed, enable the plugin on the plugin management page.
2
Open the tools menu and select Redirection.You'll see the Tools menu on the left panel in your WordPress installation. This is where you can manage all of your URL redirects.[5]
3
Click Redirects.You'll see this in the top menu bar.
4
Enter the page you want to redirect into the "Source URL" field.The source URL is relative to your website, which means instead of entering https://www.example.com/home.html to redirect home.html, just enter /home.html.
5
Enter the URL you want to redirect to. If you're redirecting to another domain, enter the full URL (e.g., https://www.newdomain.com). If you're redirecting one page to another on the same domain, you can use a relative URL like /newpage/.
6
Click the gear to access more options.Here's where you can fine-tune your redirect.
7
Select a redirect type.Select Redirect to URL from the "When matched" menu, then choose the redirect type (301 – Moved Permanently or 302 – Moved Temporarily) from the "with HTTP code" menu.[6]
You can also add more advanced redirect configurations here. See Redirection's support guide for all options.
8
Click Add Redirect to save your redirect.Once your redirect is live, the source page will automatically route traffic to the destination URL.
You can edit any of your saved redirects by clicking Edit below its entry.
Open the HTML code for the page you want to redirect.A meta redirect allows you to redirect a single webpage to another URL using a simple HTML tag. It's usually better to go with a 301 redirect for a permanent URL redirect. But if you don't have access to your web server configuration, an instant meta refresh redirect is the next best option, and is also interpreted by Google as a "permanent" redirect.[7]
Some people believe that meta refresh redirects may be seen as spammy and thus negatively impact your SEO performance. Google doesn't say this for sure, but it's something to remember.
2
Add the meta refresh code to your HTML <head></head> tags.In this example, we'll create a redirect that sends the user to https://www.newsite.com/newurl.html as soon as the page loads. The "0" indicates 0 seconds, or an instant redirect.
Save the file and reupload it to your old domain.Once the file is reuploaded, you can test the redirect in any web browser. As soon as the page loads, you'll be taken to the URL specified in the redirect.
Open the PHP file you want to redirect.If you want to redirect a PHP page to another location, you can create a permanent PHP redirect using the header() function. PHP redirects can send users to any URL or local file, even if the destination isn't a PHP-based page.
2
Add the PHP redirect code to your file.In this example, we'll redirect hits from the current page to https://www.example.com:
If you want to redirect the user to a different page on the server, replace the URL with a local path (ex. <?php header("Location: NewSite/index.php"); ?>.
Open the HTML code for the page you want to redirect.While less common than 301 and meta refresh redirects, JavaScript redirects can come in handy if you cannot use either of the options above. However, because JavaScript redirects can prevent search engine crawling bots from properly indexing pages, you should only use this type of redirect if you're not worried about SEO or need a temporary option.[9]
2
Add the JavaScript redirect code to your HTML <head></head> tags.In this example, we'll redirect all hits to the URL specified in this code.
Use a 301 redirect for permanent changes.If you're changing your URL structure, switching to a new domain name, updating your URL structure, or making any other permanent changes, always use a 301 redirect to ensure the best experience for your visitors.
If a visitor has the page bookmarked, a 301 redirect will also automatically update their bookmark to reflect the new address.[10]
For temporary changes, use a 302 redirect if possible.If you want to temporarily send visitors to another URL and have access to your web server configuration, a 302 redirect is the best option. However, if you can't access your web server configuration, you can opt for a meta refresh redirect, or use a PHP redirect if your website uses PHP. A JavaScript redirect should be your last option, as it can negatively impact the user's experience and your website's search engine performance.
Yes, you can—just use your website's settings to redirect your site to a different page. If your host doesn't have that type of setting, set up a very simple site that automatically redirects the visitor to another page.
Question
Can I redirect a website that I don't own using only my computer?
Community Answer
It depends on what you mean by redirect. If you mean to redirect incoming traffic from the website to wherever you want it to go, then the short answer is no. It's possible, but also illegal depending on where you are, and what the laws are. If you want to direct a link to a destination of your choice, use something like TinyURL or RarME.
Question
Can it be sent straight to a message with no URL?
Community Answer
You could write a javascript routine that just spits out whatever text you want it to say, but you'd still have to include that in your index.html page. At that point, you might as well just place your message in your index.html or home.html page. Then again, I'm no javascript expert. Check some of the javascript code libraries, you might find what you want; then you just cut and paste.
While some websites use an error page explaining a change of URL and include a clickable redirect link, this is less efficient than an automatic redirect and can end up costing your new site a significant percentage of visitors.
Submit a Tip
All tip submissions are carefully reviewed before being published
This article was co-authored by Stan Kats and by wikiHow staff writer, Nicole Levine, MFA. Stan Kats is a Professional Technologist and the COO and Chief Technologist for The STG IT Consulting Group in West Hollywood, California. Stan provides comprehensive technology solutions to businesses through managed IT services, and for individuals through his consumer service business, Stan's Tech Garage. Stan holds a BA in International Relations from The University of Southern California. He began his career working in the Fortune 500 IT world. Stan founded his companies to offer an enterprise-level of expertise for small businesses and individuals. This article has been viewed 1,582,339 times.