17 Comments

  1. says:

    July 10, 2010 at 2:58 pm

    Here’s a bonus one for WordPress to WordPress auto redirection.

    Just change the old blog location to the new blog location. I’ve added a delay so anyone can see that it is redirecting and a message if the redirect doesn’t work.

    Just paste everything from the next line into your header.php file just after the body tag. Then update the OLDADDRESS and NEWADDRESS bits.

    <h1>Blog has moved, switching to new one automagically (please update you link!)…</h1>
    <script type=”text/javascript”>
    setTimeout(“switchToNewBlog()”,3000);
    setTimeout(“alert(‘Switch over did not work. Goto: NEWADDRESS’)”,5000);
    function switchToNewBlog()
    {
    var newLocation = location.href.replace(“OLDADDRESS”,”NEWADDRESS”);
    window.location = newLocation;
    }
    </script>

  2. says:

    July 12, 2010 at 4:08 pm

    Actually, this wordpress – wordpress relocation script is mich better:

    Just put these lines at the very top of your header.php file and everything will automatically be redirected. Rankings on search engines should also redirect correctly with this:

    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.akademy.co.uk" . str_replace( "blog-tips", "blog", $_SERVER['REQUEST_URI'] ) );
    ?>

    Use the str_replace function to switch from one website to another. e.g.: if you are moving from”www.oldblog.com” to “www.new.com/blog” use str_replace( “oldblog.com”, “new.com/blog”, $_SERVER['REQUEST_URI'] );

  3. says:

    October 27, 2010 at 8:31 am

    Since this code will automatically redirect the blog to another, is there any code for redirecting the blog if only the homepage is open? cos from Google or Yahoo, i searched my own post (for testing), then it only show the specific html (post title) for a while before redirected to a new link. What I want is only the homepage is redirected. not the post in the blog. Help me!~

    • says:

      October 27, 2010 at 9:42 am

      Hi Nadia.

      You’ll need to check whether you are on the homepage and then redirect if you are something like:

      1. if( window.location.href == "your old blog home address" )
      2.   window.location = "your new blog address"


      Note that some home pages can have several slightly different address such as : “http://blog.akademy.co.uk” and “http://blog.akademy.co.uk/index.php” – you’ll need to check for each one, just or them together:

      1. if( window.location.href == "your first address" || window.location.href == "your second address" )
      2.   window.location = "your new blog address"

      Hope that helps.

  4. says:

    April 28, 2012 at 8:44 pm

    Thanks so much for your code! This has been the only option that has worked for me that actually links to my direct post thus saving all my Pinterest, ect. exposure and links that are currently out there! I’ve tried like 5 other tutorials that didn’t work on my site. THANK YOU! :)

  5. says:

    September 9, 2012 at 6:39 am

    Thank you SO MUCH! Works perfect. One of my clients had a blogger, which we redesigned and migrated to WordPress a few months ago… but no matter what messages and links we put on the old one, it just keeps eating all the traffic, and of course we are being penalized by Google because of the duplicated contents. We have configured the old blogger to not get indexed by search engines. I hope that helps with the second issue. Thanks again!

  6. Dom says:

    September 22, 2012 at 11:25 am

    Hi, my old blog doesn’t seem to have a header.php in the code?
    Where do i post this? I desperately need to get this working asap.
    Many thanks.

    • says:

      September 24, 2012 at 4:46 pm

      Hi Dom,

      You have to ensure the code gets added to all your blog pages. The header.php file is dependent on the template you are using, some templates may go against the recommended pattern.

      Just make sure you add the code after the tag whichever file that may be included in.

  7. says:

    September 22, 2012 at 11:27 pm

    This is perfect, I’m glad I found this page from a WordPress help page.

    I moved from Blogger to WordPress approx. 3 months ago and even though I had Google stop indexing the Blogger site, I was still getting some traffic from older posts on blogs when I used my blogspot.com URL. Until now, I had a meta direct set but that’s not helpful as it only redirects to the homepage of the new site. This is perfect and working great, thank you.

    One question though [since you've obviously been there and done that], in Google Webmaster Tools it is still reporting crawl errors from the correct website but from Bloggers permalink structure. I did have Blogger on my current URL before changing to self-hosted wordpress which is why the errors are reporting the correct URLs but wrong permalinks resulting in 404 errors. For example, it’s reporting http://www.sweet2eatbaking.com/2012/05/guest-post-rocky-road-bars.html is the incorrect URL (which it is) but not redirecting to http://www.sweet2eatbaking.com/guest-post-rocky-road-bars/ (correct URL). It shows where they’re linked from and I’ve fixed up most of the links which I can access. Is there anyway I can set a redirect so they go to the correct URL? My friend recently made the switch and her old URLs are being directed to the correct URL. How can I do the same?

    Also, in Google Webmaster Tools, I rebuilt the XML sitemap so all the correct URLs are in place and resubmitted that but the above problems are still reported. If I search my site in Google, it looks like they’ve indexed the right permalink structure. I’m at a loss what to do.

    Sorry this is so long. Hope you can help. Thanks in advance.

    • says:

      September 24, 2012 at 5:04 pm

      Hi Lisa,

      Great looking site.

      I’m no expert on this area unfortunately. As far as I know, google crawlers won’t follow the javascript redirect so maybe you should also add a meta redirect which they will understand. Maybe this wordpress plugin would be useful there: redirection.

      Alternatively you could switch the Permalink Settings of your wordpress installation to match those which blogger used (i.e. with the year and month) – though that may cause errors on your current set up.

      Sorry I can’t be more help.

  8. says:

    December 8, 2012 at 1:21 am

    Worded like a champ! Thank you so much for making my life easier and my client happy.

    I did remove the, + search; just bc it wasn’t pushing it to the homepage, but otherwise… BRAVO!

  9. says:

    February 23, 2013 at 10:53 am

    WOW! This is a great post. I have been looking for a way to make this happen and your post has made it seem very easy. Will try it out soon. Thanks for sharing.

  10. says:

    May 16, 2013 at 6:47 pm

    Hi, i have followed ur instruction to redirect blogger to wordpress and it work very well. But it got redirected to my blogpost in the new website instead. I hope to redirect it to the home page actually. I saw a similar post on your forum but i think its slightly different because I’m redirecting it from blogpost to homepage, not homepage to homepage.

    my old blog is: http://marcusfitness.blogspot.com
    my new website is: http://marcustamfitness.wordpress.com

    Please help me as I already cracking my brain over it. Thank u so much!

    • says:

      May 16, 2013 at 7:54 pm

      its ok. i found the solution. Using your HTML codes, i simply removed some parts towards the end. i removed ?s=, and also removed +search;,
      i had no knowledge of HTML codes and i am damn lucky to figure it out.
      But anyways v v v much for your redirection codes! Really appreciate your good work! Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *

To comment, click below to log in.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>