Hi there, This scirpt is not for only redirecting. that can be done with HTML only. let's say you have a forum in host 'X' .. your links are: http://x/showthreads.php?=23124324 PHP: so when you move to a new host 'Y' you want your users to be redirected to the same threads but on the new host! http://y/showthreads.php?=23124324 PHP: you first have to create a 404 page for the X host and include this script in it. <script type="text/javascript"> /* Coded by AddaxSoft webiste: www.addaxsoft.com */ var url = window.location.href; url = url.substring(url.lastIndexOf('/') + 1); document.write('<strong>We have moved to the new server... you\'re being redirected to it now....</strong>'); setTimeout("location.href = 'http://Y/' + url",2000); </script> PHP: don't forget to change 'Y' to your new host Save it as 404.html .. and use it in your old host files you're done =)
I would throw a http redirect header on the server side instead so that search engine crawlers know that the page has been moved and where to.
this redirection can be done at a much lower level, saving resources and time. you can use .htaccess redirections on the server, or in a server-side script by modifying the headers. Most of the users don't care if you're on server X or Y, as long as they get their page. I dont think a message that the server has changed and waiting two seconds is best practice. its better to issue a 301/302 header message and save the users time waiting for the "redirection page" you created. its also better for SEO, as phper said, because then [favorite-searchengine-here] updates all the links to your old page to point to the new one, giving it more juice.