Home Internet Redirect User to Different Domain without Loosing Website Traffic

Redirect User to Different Domain without Loosing Website Traffic

by John Bhatt
314 views

Hi,

Recently, I have changed my Blog address. Due to this, I have to face a lot of Traffic Loss.

My situation was, I have a Blogger blog and a domain. A lot of Links have been shared and If I change the Blog address and create a Permanent Redirect by changing DNS, but existing Bookmarks and Shared Links will not load properly. So, I kept the Existing Domain running and created a New Blog. Exported Template and Blog, Uploaded both to New Domain and just keep both domain running up. Now I have to redirect all visitors to Previous Domain to New Domain. So that website traffic coming from shared links should be alive and must work.


Here I came with a solution.

I have created a Simple JavaScript function.
[javascript]

function redirect()
{
//You change your Domain name just in place of “//www.pyarb.com”.
window.location = “//www.pyarb.com/” + window.location.pathname;
}

[/javascript]
Description:

1. windows.location – This will set the Location of Window (i.e. Address of Browser.)
2. “//www.pyarb.com” – This is your New Domain. Where you have kept all File structure same. Means Links are same for All files except Domain Name.
3. windows.location.pathname – This will get the Path of Window Location (i.e. Address of Browser except Domain Name.)

Then Executed this function on PageLoad event.
[html]
……
…….

………
………
[/html]

That’s It. Your location remains same.

Enjoy,
+John Bhatt 

 

You may also like

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Redirect User to Different Domain without Loosing Website Traffic

by John Bhatt time to read: 1 min
0