What is a Meta Redirect?
A meta redirect, or meta refresh redirect, is an HTML attribute that instructs the browser to refresh and redirect the user to another URL after a specified period of time.
The meta redirect is a client-side redirect. That is, it occurs on the visitor’s browser. You can create one by adding the meta redirect code below to your site.
<meta http-equiv="refresh" content="5; url=https://yourdomain.com">
The above code instructs the browser to redirect the visitor to https://yourdomain.com after five seconds. However, you can edit the contenu
et url
attributes to suit your requirements.
Dans le code ci-dessus :
méta
indicates the code is a meta tag- La
http-equiv
attribute specifies the meta tag is a meta redirect - La
contenu
attribute specifies the time (in seconds) after which the redirection should occur - La
url
attribute specifies the URL the visitor will be redirected to
Google Best Practices on Using Meta Redirects
Google interprets some redirections better than others. Here is a rundown of the redirections Google recommande you use, starting with the ones with the highest chances of being interpreted correctly.
- Server-side redirects
- Meta redirects
- JavaScript redirects (permanent redirections only)
- Crypto redirects (permanent redirections only)
As you can see, Google interprets server-side redirects (like 301 and 302 redirects) better than meta redirects. In addition to this, Google added that search engines may require a bit more time to detect redirections other than server-side redirects.
Google also pointed out that some browsers do not support meta redirects, and visitors may get confused when they encounter them.
All in all, Google recommande that you consider server-side redirects your first choice for redirections. Meta redirects are a second choice, and you should only use them when you are unable to set up server-side redirects.
How to Set Up Meta Redirects
You can create meta redirects by adding a meta redirect code to the head tag of the HTML code of the page you are redirecting from.
Par exemple:
<!DOCTYPE html> <html> <head> <meta http-equiv="refresh" content="5; url=https://yourdomain.com"> </head> <body> <h1>Redirecting...</h1> <p>You will be redirected to https://yourdomain.com in 5 seconds.</p> </body> </html>
However, the exact meta redirect code you use depends on whether it is a permanent or temporary redirection. Google supports two types of meta redirects:
- Instant meta refresh redirect
- Delayed meta refresh redirect
Instant Meta Refresh Redirect
The instant meta refresh redirect redirects the visitor to the specified URL immediately the page loads. Google treats this as a permanent redirect and considers it a strong signal that the destination page should be canonical.
You can specify an instant meta refresh redirect by setting the contenu
attribute of the meta tag to 0
. For example:
<meta http-equiv="refresh" contenu="0; url=https://yourdomain.com">
Delayed Meta Refresh Redirect
The delayed meta refresh redirect redirects the visitor to the specified URL one or more seconds after the page loads. Google treats it as a temporary redirection and considers it a weak signal that the destination page should be canonical.
You can specify a delayed meta refresh redirect by setting the contenu
attribute of the meta tag to a number greater than zero. For example, the below code instructs the browser to refresh the page after 12 seconds.
<meta http-equiv="refresh" content="12; url=https://yourdomain.com">