How to Redirect a Web Page in HTML
To tell website visitors and search engines that your web page has permanently moved to a new location with equivalent content use a 301 redirect. The code “301” is interpreted as “moved permanently”. (Learn more about HTTP Status Codes).
How to Redirect to Another URL¶
The simplest way to redirect to another URL is to use an HTML <meta> tag with the http-equiv parameter set to “refresh”. The content attribute sets the delay before the browser redirects user to the new web page. For redirect to occur immediately set this parameter to “0” seconds for the content attribute.
<meta http-equiv="Refresh" content="0; url=https://www.w3docs.com" />
If you want your redirect to occur in an exact time, just define your preferred parameter (in seconds) for the content. Let’s consider an example set with 7 seconds redirect time set.
Some browsers do not correctly render the <meta> refresh tag, so before the next page loads, the user can see a flash as a page.
<meta http-equiv="Refresh" content="5; url=https://www.w3docs.com" />
Some old browsers don't correctly refresh when you add a quick link. In that case you can add an anchor link in order to let the user follow.
<html> <head> <meta http-equiv="Refresh" content="7; url=//www.w3docs.com" /> </head> <body> <p>Please follow <a href="//www.w3docs.com/">this link</a>.</p> </body> </html>