How to automatically redirect a browser
Have you changed your server or shifted your domain and are losing out your traffic. Here is all you have to do to redirect people from your previous site to the new one. Let us assume you want to redirect http://bothack.blogspot.com to https://bothack.wordpress.com/ Here is how redirection works:
1) You add a special line of HTML code into the header of your html file, so that it looks like this (longer lines may wrap in your browser window, though they are actually on a single line):
In the above code, you’d change ‘N’ to some other number to delay the redirect. If you changed it to 5, the redirect would be delayed for 5 seconds. The URL is up to you, of course. The above example redirects to another site entirely, while it could just redirect to ANY other URL, such as another page on the same site, or a different webserver/port on the same server. It is also a good idea to add some text to your redirecting page, such as “You will automatically be redirected to the new site in xx seconds,” so the user knows what is happening. Also, you should add a link to the new site in the text, in case the user has some antiquated browser that doesn’t support redirection. You have probably seen this on other sites. Your complete html file which redirects users to your new page will end up looking something like this. If say the site is http://bothack.blogspot.com, then anyone accessing it would automatically end up at https://bothack.wordpress.com instead.
2) But if you are like me, and dont want any delay between the redirection, you could relent to scripting your site. Just add it’s code along with the meta code.
4) So a complete example :
Click HERE to see an example of it.
Filed under: Hacks, How-To | 10 Comments