You are here:Home » SEO » 3 different techniques for redirecting old websites to new URL

3 different techniques for redirecting old websites to new URL


Whenever you wanted move your domain to a new one and you don’t want to loose the traffic that is coming for old website, you should opt for redirection. Redirecting old websites to new URL is not that hard to implement. It can also be done in client side by using simple JavaScript in the website code.




Note: Implement either of the following codes inside <head>…</head> section. Don’t forget to remove the comment tags( ‘<!—’ ,‘–>’ ,’//’and ‘/*…*/’) before you save the changes after implementation.

Method 1: Simple redirection

This method has simple code of redirecting to new website’s URL. Copy the code below and paste it in the <head>…</head> section. Replace http://www.newlocation.com with your new website’s URL.
<script type="text/javascript"> <!-- window.location="http://www.newlocation.com"; //--> </script>

Method 2: Show message before redirection

This method of redirecting features a popup message in old webpage. You can customize the message in the code below before implementing it in your website/blog. To do so, replace you will be redirected to main page in 10 sec with the text of your wish.
<script type="text/javascript"> <!-- function Redirect() { window.location="http://www.newlocation.com"; } document.write("You will be redirected to main page in 10 sec."); setTimeout('Redirect()', 10000); //--> </script>

Did you figure out why it takes 10 seconds to your page to redirect to the new URL? The part of the code setTimeout(‘Redirect()’,10000) is responsible for that delay. It actually means that the function Redirect() would be redirected after ten seconds of timeout. You can change this timeout delay also to the time you wanted.

Remember, 1 second here represented as 1000 and so it was specified as 10000 for 10 seconds of timeout. Keep that in mind before setting the timeout.

Method 3: Redirecting based on their browsers

This method of redirection allows the old website to be redirected to particular URL based on the web browser it is opened in. See the code below,
<script type="text/javascript"> <!-- var browsername=navigator.appName; if( browsername == "Netscape" ) { window.location="http://www.location.com/ns.htm"; } else if ( browsername =="Microsoft Internet Explorer") { window.location="http://www.location.com/ie.htm"; } else { window.location="http://www.location.com/other.htm"; } //--> </script>

You can customize the URL’s based on the compatibility of the browsers it is opened in. The URLs in window.location are supposed to be customizable.

Don’t forget to remove the comment tags before saving the changes after implementation of the codes above.

0 comments:

Post a Comment

We're happy to read your thoughts and we'd try our level best to clear your queries if asked. Let's discuss it in a better way. Please don't spam and spoil the conversation :) Thank you!!