{"id":79,"date":"2019-04-17T18:15:42","date_gmt":"2019-04-17T18:15:42","guid":{"rendered":"https:\/\/r0b3rt.com\/andr-web\/?p=79"},"modified":"2019-04-17T18:15:42","modified_gmt":"2019-04-17T18:15:42","slug":"how-it-works","status":"publish","type":"post","link":"http:\/\/r0b3rt.com\/andr-web\/how-it-works\/","title":{"rendered":"How it works"},"content":{"rendered":"<p>When you click on a link like that, an HTTP request is send to their server with the full URL, like <a href=\"http:\/\/bit.ly\/duSk8wK\" rel=\"noreferrer\">http:\/\/bit.ly\/duSk8wK<\/a> (links to this question). They read the path part (here <code>duSk8wK<\/code>), which maps to their database. In the database, they find a description (sometimes), your name (sometimes) and the real URL. Then they issue a redirect, which is a HTTP 302 response and the target URL in the header.<\/p>\n<p>This direct redirect is important. If you were to use files or first load HTML and then redirect, the browser would add TinyUrl to the history, which is not what you want. Also, the site that is redirected to will see the referrer (the site that you originally come from) as being the site the TinyUrl link is on (i.e., twitter.com, your own site, wherever the link is). This is just as important, so that site owners can see where people are coming from. This too, would not work if a page gets loaded that redirects.<\/p>\n<p>PS: there are more types of redirect. HTTP 301 means: redirect permanent. If that would happen, the browser will not request the bit.ly or TinyUrl site anymore and those sites want to count the hits. That&#8217;s why HTTP 302 is used, which is a temporary redirect. The browser will ask TinyUrl.com or bit.ly each time again, which makes it possible to count the hits for you (some tiny url services offer this).<\/p>\n<p>COMMENTS:<\/p>\n<p><span class=\"comment-copy\">Actually I think, Bit.ly uses HTTP 301 instead of 302 (the last I heard)<\/span><\/p>\n<p><span class=\"comment-copy\">Since bit.ly won&#8217;t let you change where one of their URLs points to, 301 makes sense. No need to remember the bit.ly version and recheck it.<\/span><\/p>\n<p><span class=\"comment-copy\"> it is indeed HTTP 301 that is used, however, with a timestamp. This turns it into a <code>Moved<\/code> not <code>Moved Permanently<\/code>. This is a subtle difference. By adding the timestamp, the browser considers it should check whether the resource is changed or not when this timeout it reached. Others, like is.gd, use a normal <code>301 Moved Permanently<\/code> and the browser doesn&#8217;t need to re-check (but often will). Finally, services like url4.eu do not redirect at all, but show you an advertisement first. With the 301 the services can still count <i>unique visitors<\/i>, but not all hits.<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you click on a link like that, an HTTP request is send to their server with the full URL, like http:\/\/bit.ly\/duSk8wK (links to this question). They read the path part (here duSk8wK), which maps to their database. In the database, they find a description (sometimes), your name (sometimes) and the real URL. Then they &hellip; <a href=\"http:\/\/r0b3rt.com\/andr-web\/how-it-works\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How it works&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-computer-it"],"_links":{"self":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":1,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":80,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/posts\/79\/revisions\/80"}],"wp:attachment":[{"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/r0b3rt.com\/andr-web\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}