Friday, November 20, 2009

Is there a better way to change the URL/address of my blog?


Blogger.com allows you to change the URL/address of your blog in blogspot.com. Just go to the dashboard and select tab Settings|Publishing. Change the URL there and Bang! Your original address is gone, together with your traffic and your readers.

I figured out a better way to get your new blog running and not lose your readers.

Step 1: Clone the blog with a new address

You can create a new blog with the address you desire. Then clone your blog to the new one. To clone, you can go to Blogger.com dashboard and (skip the first 2 steps if you haven't manually modified the template of your blog):
   1. Download the template of the old blog on page Layout|Edit HTML;
   2. Upload the template to your new blog on page Layout|Edit HTML;
   3. Export your old blog on page Setting|Basic|Blog Tools;
   4. Import the xml file to your new blog on page Setting|Basic|Blog Tools.

Step 2: Tell the readers your new address

You can add a description below the title of your blog to tell the readers that you have moved by editing the Header in Layout|Page Elements.

Step 3: Automatically redirect to your new address (optional)

With some JavaScript code on the old blog, you can redirect the readers to the new blog. But keep in mind that not all users enable the JavaScript in their browsers.

To add the redirecting code, go to the page Layout|Edit HTML of your old blog. Look for the tag <head> and add these right below it:
<script type='text/javascript'>
function forwardUrl()
{
   var oldDomain = "http://old-url.blogspot.com/";
   var newDomain = "http://new-url.blogspot.com/";

   var myUrl = location.href;

   if (myUrl === oldDomain)
      location.href = newDomain;
   else
   {
      var oldDomain2 = oldDomain + "search/label/";
      if (myUrl.search(oldDomain2) >= 0)
         location.href = myUrl.replace(oldDomain, newDomain);
   }
}
</script>

Change old-url.blogspot.com and new-url.blogspot.com to your own URLs.

Look for tag <body> in the template and change it into:
<body onload='forwardUrl()'>

Save the template. And it is done.

After this, whenever the users enter the Home of your blog or click on any labels, they will be redirected to the new blog.

That was how I changed my blog from ttt-jl.blogspot.com to  tiptt.blogspot.com. Click on ttt-jl.blogspot.com and you can see how it will be forwarded.

Before this solution, I have tried to use Settings|Publishing|Custom Domain to forward the old URL to the new one. Unfortunately, Blogger.com doesn't allow me to forward to a blogspot.com address.

If you have any better ideas, please let me know.

No comments:

 
Get This <