Submitted by: Bradley Jones(bjones@quinstreet.com)

Friday Mar 25th 2016 by Brad Jones

 Redirect site visitors to a new page with this simple redirect and avoid the dreaded 404 error.

When a person comes to a page, it is actually possible to redirect them to a new page. Because someone might have bookmarked the page, you can use this when you want to remove a page from your site so that you can avoid sending the person to a 404 error page.

window.location = "http://www.devx.com"; 

This page will be gone in a blink of the eye because of the script redirect!

Looking at the code, you'll see that the window location is changed to www.devx.com. You could change this to any other site as well. The one downfall with this redirect is that if scripting is turned off, it won't work.

Mobile Site | Full Site