Here are some of the main reasons why we would redirect the user from the actual page to a new page.
- When you change your domain, and you want to redirect your all users from the older domain to the new domain, in that case, you can use the Page redirection.
- Google has already indexed your page, now you have changed your domain, and you do not want to lose your traffic to the dead pages, there also you can use the page redirection so the user gets redirected to the new link when they try to access the old one.
Working of Page-redirection
Click the button for page redirection.
In the above example, we created a static button that will redirect the user to the new page. But the above same tasks can be achieved using HTML anchor tag <a>. Let’s write a JS script that will automatically redirect the user to a new page after 5 seconds of loading the page.
- By specifying the new URL link to the
window.locationproperty we can redirect the user to the new page.