When a URL redirects to a different URL when an attempt is made to access the web page that is called URL redirection. This can be done for both legitimate and malicious purposes.
Wikipedia
URL redirection, also called URL forwarding, is a World Wide Web technique for making a web page available under more than one URL address. When a web browser attempts to open a URL that has been redirected, a page with a different URL is opened. Similarly, domain redirection or domain forwarding is when all pages in a URL domain are redirected to a different domain, as when wikipedia.com and wikipedia.net are automatically redirected to wikipedia.org.
URL redirection is done for various reasons:
for URL shortening;
to prevent broken links when web pages are moved;
to allow multiple domain names belonging to the same owner to refer to a single web site;
to guide navigation into and out of a website;
for privacy protection (such as redirecting YouTube and Twitter links to Invidious and Nitter respectively or to turn AMP links into normal links); and
for hostile purposes such as phishing attacks or malware distribution.