GET parameters (also called URL parameters) are used when a client, such as a browser, requests a particular resource from a web server using the HTTP protocol. They define the requested resource and are always name-value pairs.
How do GET requests work?
HTTP works as a request-response protocol between a client and a server. A total of nine different request methods are defined in HTTP to specify what action the server should perform on a given resource. Each of these request methods implements different semantics. The GET request is one of the most common HTTP request methods.
A GET request is used to request data from a specified resource. A client, for example a browser, can use this HTTP method to retrieve a web resource from a server. With GET requests, the client transmits GET parameters along with the queried URL. GET parameters are always name-value pairs and are added to the URL with a "?". The name and the associated value are always separated by a "=".
A GET request has the following exemplary syntax:
However, the same GET request can transmit several parameters. The length of the request and thus the number of name-value pairs transmitted is only limited by a URL’s maximum length. When several parameters are transmitted, an ampersand (&) separates them. If multiple parameters are used when using the filter function of an online shop, for example, the GET request can look as follows:
The server's response to a client request contains information about the availability and location of the queried resource. This means that the response does not include the requested resource itself. However, the browser can then load and display it based on the information received from the server. The reason for these reciprocal requests and responses between client and server is that the HTTP protocol only allows one response at a time.
Properties of GET requests
In general, GET requests can be buffered and bookmarked. In addition, they are saved in the browser history. For this reason, you should not use this HTTP request method when handling sensitive data, such as login information.
Furthermore, a GET request only retrieves data and does not change any resources. It is assumed that this is a secure, repeatable operation of browsers, caches, and other HTTP-enabled components. This means that GET requests can be reissued without prior validation. For example, the display of your account balances performed with a GET request has no effect on your account and can be safely repeated. Therefore, browsers allow users to refresh a page resulting from a GET request without displaying a warning. Other HTTP-enabled components such as proxies can also automatically resubmit GET requests when they encounter a temporary network connection problem.
However, a disadvantage of GET requests is that they can only provide data through parameters that are added to the Uniform Resource Identifier (URI) or sent as cookies in the cookie request header. You cannot use this method to upload files or perform other operations that require large amounts of data to be sent to the server.
GET parameters and duplicate content
Generating GET parameters, for example, based on website filter settings, can cause serious problems with duplicate content on e-commerce sites. When shop visitors can use filters to sort or narrow the content on a page, additional URLs are generated. This happens even though the content of the pages does not necessarily differ. The following example illustrates this problem:
One solution to this problem is to uniquely define the relationship between the pages using canonical tags.
Canonical tags indicate to search engines that certain pages should be treated as copies of a particular URL and all ranking properties should be credited to the canonical URL. A canonical tag can be inserted in the <head> area of the HTML document or alternatively in the HTTP header of the web page. If the canonical tag is implemented in the <head> area, the syntax is, for example:
<link rel="canonical" href="https://www.example.com/all-products.html"/>
If this link is added to all URLs that can result from different combinations of filters, the link equity of all these subpages is consolidated on the canonical URL and Google knows which page should be displayed in the SERPs.
Canonical tags are therefore a simple solution to guide search engine crawlers to the content they are supposed to index.
Another way to avoid duplicate content caused by GET parameters is to add canonical URLs to a sitemap.
Problems with duplicate content can generally be prevented by eliminating unnecessary parameters in a URL. This has the added benefit of improving usability since overly long URLs are illegible and difficult for users to understand.