The meta refresh tag can be used in a variety of ways, and one of them is to provide a timed redirect to another page. A good example of where this can be used is the 404 error page. A custom 404 page can be created and include the meta tag so that it redirects to a more useful page for a website visitor. The following tutorial walks you through making a 404 error page with the meta refresh tag.
Creating a custom 404 error redirect page with the meta refresh tag
- Login to the cPanel.
- Use the cPanel tool to create a custom 404 page.
- When you are creating the custom 404 error page, add the following code towards the bottom of the file:
<meta http-equiv="refresh" content="10;url=http://domain_name.com/">
"content=10" - the number of seconds the page will remain on display before it redirects to the URL.
";url=http://domain_name.com"> - this portion of the code shows where the page will redirect.
Make sure that you add an alternate link on the error page so that your customers can elect to click on it or simply wait for the page to automatically jump to your designated web page
- SAVE your custom error page.
Test your custom 404 page - you can use a bad link or create one by simply adding a bad link after the primary domain in browser. You may need to change the time that the page will display. Make sure that you have provided a link that a customer can click on if they don't want to wait, or if the re-direct simply does not work.