Redirection is when a URL is moved from one location to another, and two types can be used: permanent (301) and temporary, or 302. Redirect is usually necessary when we have a new page that will replace an old one, and we need to signal searchers which URL to consider now.
What is a redirect?
Also known as URL forwarding or call forwarding, it is a World Wide Web technique to make a website have a new URL structure without any of them having an unreachable status.;
When the web browser tries to access the redirected URL, it opens a page with a different URL. Domain redirection also occurs when all pages in a URL domain are redirected to another part; for example, wikipedia.com and wikipedia.net are automatically redirected to wikipedia.org.
What is the purpose of the redirect?
The general purpose of redirection is to drive traffic from one page to another. This happens for several reasons.
URL redirection is done for several reasons:
- to shorten the URL;
- to avoid broken links when moving web pages;
- to allow domain names with multiple names that contain the same owner to point to a single site;
- for direct navigation in and out of a website;
- to protect privacy; and
- For malicious purposes such as phishing attacks or spreading malware.
How does the transfer work?
Over HTTP, the redirect is triggered by a server that sends an exceptional redirect response to a request. Responses have status codes starting with a three and a Location header that contains the URL to which they will be redirected.