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

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.

63 replies on “Moving Your Blog: A WordPress Plugin to Permanently Redirect Your Posts”

  1. 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. 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. 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.

  4. 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

  5. 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.

  6. 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).

  7. 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.

  8. 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.

  9. 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.

  10. 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!!!

  11. 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.

  12. 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?

  13. 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?

  14. 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

  15. 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.

Comments are closed.