A Few Blips A Word of Caution When Changing Domains

Moving Your Blog: A WordPress Plugin to Permanently Redirect Your Posts

Print Version September 23rd, 2006

If you ever have cause to move a WordPress blog from one domain to another you will want visitors to any pages on the old site to be silently redirected to the corresponding page on the new site. This goes particularly for Googlebot and other search engine spiders: you want them to be able to find your new site and update their databases so you don’t lose your ranking.

Moving Your Blog is a simple WordPress plugin that redirects all your posts and pages (status 301, permanently moved). The Admin pages are exempt so you can still administer the old blog.

Instructions

  1. First setup your new blog in its new domain so that every post and page in the old site has its copy in the new site.
  2. Download the latest version of Moving Your Blog.
  3. Unzip and copy moving.php to the wp-content/plugins folder of your old blog.
  4. Activate the plugin from the Admin Plugins page.
  5. Visit the Admin Options|Moving page and enter the address of your new blog. When you update the address the plugin becomes active and starts to redirect your posts and pages.
  6. To turn off redirection delete the address of your new blog.
  7. If you need to uninstall the plugin it can be deactivated from the Admin Plugins page and/or deleted from your wp-content/plugins folder.

Version

This is version 1.0 of Moving Your Blog. It is my first WordPress plugin.

Given the nature of this plugin it is hard to test so, for now, consider it beta software. If you try it let me know how it goes. The usual disclaimers apply.

Entry Filed under: Programming,WP Plugins

63 Comments

  • 1. jay  |  September 23rd, 2006 at 12:05 pm

    This is the exact situation I have been trying to deal with. When I launched gotfoo.org I thought it would be cool to have sub-domains just like slashdot.org. But now after 6 months I am finding that it’s a real pain trying to manage 2 different installs of WordPress and I basicly want to open a 3rd install at the root level and stop posting to the other 2.
    This is perfect.
    One question: How long do I need to keep the other blogs open before I can shut them down?

  • 2. Rob  |  September 23rd, 2006 at 2:27 pm

    jay: I honestly don’t know yet. I’m waiting to see how long it is before Google et al. make the changes.

    I hadn’t considered your situation of effectively merging two blogs into one but I can’t see why it shouldn’t work. Let me know of any successes or problems.

  • 3. Dr J  |  September 23rd, 2006 at 2:29 pm

    Excellent plugin Rob. Worked perfectly for me and exactly as advertised!

  • 4. Michael Hampton  |  October 7th, 2006 at 6:41 pm

    Oh, the lost art of editing .htaccess … :)

  • 5. Chris  |  October 30th, 2006 at 9:14 am

    Hello,
    Just wondering if anyone could help. I did something stupid and started my blog using a numerical archive system, and now I'd like to change it so that the post title is part of the URL for SEO reasons. Is there any WordPress plugins that anyone knows of that could switch it without sending Googlers to invalid pages? Maybe some sort of redirector to the correct page?

    Thanks.

  • 6. Quinton  |  November 17th, 2006 at 4:59 pm

    Does anyone know the name of the wordpress plugin that creates a list of your posts in a category instead of just displaying them one after the other? I want it so that when someone clicks on a category they just get a list of posts from that category.

    I'm sure Ive seen one…and sifting through the WP site is a nightmare

  • 7. Quentin  |  December 12th, 2006 at 9:01 pm

    What I want to do on my blog, is every few hours take the oldest post and move it to the
    front of the queue, all automatically. Anyone know if there is a plugin that can do this or
    a simple way to set up another plugin to do this (use my own feed perhaps)?
    Thanks.

  • 8. Rob  |  December 13th, 2006 at 10:19 pm

    Quentin: If you mean that literally all you would have to do is change the date field of the oldest post to make it become the newest. I doubt very much there’s a plugin to do that but the code should be easy (apart from the ‘every few hours’ bit).

  • 9. danielsemper  |  February 23rd, 2007 at 3:29 am

    I used this plugin to move my blog from http://ctrl-f5.vectorice.com/ to http://www.aeromental.com/

    I did it on Feb 19th, today is Feb 23th and my PageRrank at my new domain is still PR0 “zero” nada :(

    I had a PR6 in my previous blog.

    Did anybody know how long will it be to recover my PageRank?

  • 10. Rob  |  February 23rd, 2007 at 8:12 am

    daniel: I thought that official PageRank was only updated at intervals rather than continuously. Google’s index updates within days though. Do you use Google’s webmaster tools? They can give you a snapshot of the process in action.

  • 11. margono  |  March 26th, 2007 at 5:11 am

    is this trick still available for now freely? i need to redirect anawinta.wordpress.com to http://www.qiraati.com how-to?

  • 12. Rob  |  March 26th, 2007 at 7:39 am

    margono: if you can install the plugin on your original blog it should redirect for you. Please read the instructions carefully.

  • 13. Baz L  |  March 31st, 2007 at 11:55 pm

    Does the new site need to have the exact same permalink structure of the old site?

    Also, what happens with Technorati, if anyone knows?

  • 14. Rob  |  April 1st, 2007 at 12:30 am

    Baz: Yes the permalink structure has to be identical for this plugin to work.

  • 15. margono  |  April 1st, 2007 at 7:48 am

    Rob, I did wht u said but i cant find when to put the plug-in in? Do you ever know where the easest blog provider to modify its contents also directed domain, pls tell me. thank you.

  • 16. Rob  |  April 1st, 2007 at 2:14 pm

    margono: I’m sorry but I don’t understand your questions…

  • 17. margono  |  April 2nd, 2007 at 6:03 am

    I mean, is there any blog provider (wordpress, blogspot etc), have an easy plug-in to make redirected domain to our personal domain like this… anawinta.wordpress.com —> redirected to http://www.qiraati.com.

  • 18. Rob  |  April 2nd, 2007 at 7:45 am

    margono: Ah, I see. Since I don’t use a blog provider I really don’t know. I do vaguely remember reading somewhere that wordpress.com offers some paid services that might include such a tool.

  • 19. Baz L  |  April 4th, 2007 at 1:48 pm

    Just giving a review.

    I used it and it’s excellent. It does what it says and it does it well. ThanX.

    The ordinary 301 redirect is nice, but the fact that this plugin shows the new URL in the browser is excellent!!!

  • 20. Rob  |  April 4th, 2007 at 4:31 pm

    Thanks Baz!

  • 21. Donna S  |  June 16th, 2007 at 8:57 pm

    I want to move my WP blog from inside a folder on my host to the root so instead of http://dmstrachan.co.uk/journal it lives at http://dmstrachan.co.uk

    Am I correct in the assumption that I just need to move the contents of /journal then run your plugin to update the links in the blog itself?

  • 22. Rob  |  June 17th, 2007 at 5:40 pm

    Donna: I think it will be more complicated than that. You need to find some instructions for setting up a new blog in the right place with a COPY of all your posts etc. The export/import method isn’t guaranteed to work since posts can get assigned different slugs. You need to dump the database and load it into your new blog. BazL who commented above covers the process well.

    If all goes well at that point you will have two identical blogs at different addresses. What the plugin does is allow you to install it on the OLD blog so that any requests for posts at the old address will be re-routed to the new address. This means that you have to keep the old installation of WordPress active but once you are sure that everything is working well you can get rid of all your old blogs plugins and posts and just keep the skeleton installation with this plugin running.

    Ideally if you keep stats at some point you’ll notice that all but a few visitors come to your new blog directly and then you can replace the old blog with a simple information page giving the address of your new blog.

    I hope this makes sense.

  • 23. Jack  |  November 17th, 2007 at 9:27 am

    Hi all, see here… mini-howto, make redirects in all other methods and languages

  • 24. KWiz  |  November 23rd, 2007 at 5:22 pm

    Hi,
    My current blog is an old WP version (2.0), and I’d like to upgrade it to the current version. My host offers Fantastico, but I found that when I upgrade, my blog breaks. So I’d like to copy my old blog (.com) posts, comments, etc. to a new domain name (.net), redirect to the new domain name (.net), update the old blog (.com) to the new version of WP (fixing any breaks, if needed), then going back to the old blog (.com). Will this plug-in enable me to do this?

  • 25. Rob  |  November 23rd, 2007 at 5:31 pm

    KWiz: This plugin will only help with one of those steps–the redirection. I’m not sure whether it does what you want exactly though. It redirects with a code for a permanent redirect but from your description you might only want the redirect to be temporary, while you update the original blog?

  • 26. Mikey  |  November 28th, 2007 at 7:19 pm

    Yeah, this is a very very cool blog. ;-)
    I just added you to my favorites.

    Thanx,
    Mikey

  • 27. ericabiz  |  December 4th, 2007 at 12:55 am

    YAY! This plugin worked GREAT! Thank you so much. Moved slashchick.com -> erica.biz painlessly.

  • 28. sekano  |  February 18th, 2008 at 10:32 pm

    Muy buen plugin, me está salvando el tráfico ahora que me he mudado a un nuevo dominio en otro servidor.
    Gracias

  • 29. Dilneiss  |  February 19th, 2008 at 3:13 am

    aahhh
    link offline =(
    can u fix that link please??

  • 30. Dilneiss  |  February 19th, 2008 at 3:13 am

    aahhh
    link offline =(
    can u fix that link please???

  • 31. Boogle  |  February 26th, 2008 at 7:22 pm

    Has any one had any major issues with this method? I am Looking at moving my bog over but am hesitant.

  • 32. Lichao  |  June 1st, 2008 at 2:09 am

    Hi, Rob,

    When I undated the the new URL, I got an error message saying that “The requested URL http:// was not found on this server.”

    What could be wrong?

    Thanks

  • 33. Rob  |  June 1st, 2008 at 11:13 am

    Lichao: What did you enter as the new URL? Also can you give details of your platform, server, etc.

  • 34. Lichao  |  June 2nd, 2008 at 4:23 am

    Hi, Rob,

    I figured out what the problem is and was able to bypass it, but that’s not an elegant solution. I set up my wordpress installation in a folder called blog and pointed a subdomain at the installation. So the old blog url is blog.example.com and the physical address is example.com/blog.

    So here is the line that caused problem

    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=moving.php">
    

    $_SERVER['PHP_SELF'] returns the actual physical address, which includes the subdirectory, blog/wp-admin/options-general.php, so the update button actually points to
    blog.example.com/blog/wp-admin/options-general.php?page=moving.php, which leads to a 404 error.

    My solution was to hardcode the URL into this line, but I bet you will find a better solution.

    Finally, this is an excellent plugin and thank you very much for giving it out for free.

  • 35. Velvet Blues  |  October 4th, 2008 at 8:05 pm

    We recently released an Update URLs plugin which help replace all occurrences of your old domain with your new domain.

    It fixes the permalinks as well as any links within you posts or pages.

    It can be found at: http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/

  • 36. araç kiralama  |  May 14th, 2009 at 5:25 pm

    I’m sure Ive seen one…and sifting through the WP site is a nightmare


Calendar

September 2006
M T W T F S S
« Aug   Oct »
 123
45678910
11121314151617
18192021222324
252627282930  

Related Reading