meta tags. We’ll discuss how and when to use them.
Of course, if you have the ability to set up something better, you should take it. If you have full access to the web server your site is running on, you should probably set up a 301 or 302 redirect, or if the resource is on the same server, set up a URL rewrite so that the user isn’t affected at all. Even shared hosting with Apache can handle 301 redirects with
.htaccess configuration files.
However, the real world isn’t always as pretty, and sometimes you just need to deploy an HTML page that redirects every user somewhere else. Usually, this is most useful in cases where you cannot use a proper
.htaccess file, such as with certain content management systems that overwrite it.
This is still not a great solution—it’s not great for SEO, as it’s a client-side redirect, and this kind of redirect will show a white screen on the user end while waiting for the redirect to kick in. If you still want to set one up though, HTML has some tools built into it.
Using HTML meta refresh redirects, you can send a user to a new page. Create an HTML file with nothing but the following, replacing example.com with your URL:
<meta http-equiv="refresh" content="0; URL=https://www.example.com/" />
The zero before it means that this redirect will happen instantly, which is probably ideal. However, if you want to instead display the annoying “click here if you’re not redirected in five seconds message,” you can do that as well, adding a second link that users :
<head> <meta http-equiv="refresh" content="5; URL=https://www.example.com/" /> </head> <body> <p>If you are not redirected in five seconds, <a href="https://www.example.com/">click here</a>.</p> </body>
However, HTTP meta refresh redirects are supported in every single browser, so it’s almost always better to just redirect users instantly.