How to Write an HTML Redirect

The web is a very dynamic place. In some cases, you may need to change things around a bit in order to have a better structure in your website or to add some other things. This may need you to change the location of web pages from their original locations. In this case, you do not want the user to get lost inside your website when they try to visit pages that they had been to previously and even probably bookmarked.

For instance, you may move your files from one folder to another within the same site structure when you want to expand your site. If a signup page was originally on example.net/signup.html and you moved things around on your side and now the page is on example.net/secure/signup.html, you will need to redirect the user appropriately so that they do not get lost even when they visit the previous page.

Now, in order to accomplish this, we can make use of the Meta Refresh tag in HTML. Meta refresh is a way in which you can tell the web browser to go to a different page.

Sample HTML Redirect Code:

It is important to note that this only works for single web pages in scenarios such as this one where we have moved a couple of pages and not for shifting an entire website.

Leave a Reply

Your email address will not be published. Required fields are marked *