How to Redirect a Web Page Automatically to Another Web Page in HTML?

Problem:

You have an html page. May be it is old version or corrupted. When users click for the page, you want to send users to another link or page. Suppose a person visits “website.com/page-a” in the browser and the page is redirected to “website.com/page-b” instead. How do you do that?

Solution:

The simplest way to redirect to another URL is with the Meta Refresh tag The code Add the following meta tag inside the head element of HTML page

<meta http-equiv="refresh"content="0; url=http://google.com/"/>

Explanation:

Meta refresh is a method of instructing a web browser to automatically refresh the current web page or frame after a given time interval. To refresh the current page, “http-equiv” parameter set to “refresh” and to set time interval “content” parameter is used in second unit. Suppose if “content” set to 5, the page will refresh after 5 seconds interval. If we want to redirect the current webpage to another page, “url” parameter is used. If we use “url=http://example.com/”, the current page will be redirected to “example.com” page. So here “meta” element is used to redirect the current to another page with a refresh after a given time.

But the use of meta refresh is discouraged by the World Wide Web Consortium (W3C), since some browsers don’t support it