WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
records imported from blogger (2 posts)

  1. Workshopshed
    Member
    Posted 3 years ago #

    The records imported from blogger have the old permalinks stored in the post meta data under a tag called "blogger_permalink"

    e.g. for a post with the title

    "what happens if the blog title is really long? what will be the permalink for this?"

    WordPress is creating:

    /2011/04/what-happens-if-the-blog-title-is-really-long-what-will-the-permalink-be-for-this/

    But the blogger value is:

    /2011/04/what-happens-if-blog-title-is-really.html

    I've already implemented a set of simple redirects using this plugin to handle the changes to the categories and to strip of the html

    See:
    https://docs.google.com/document/pub?id=1GPhkOGioq0t5MJB5nUI4EBL0x0KhK4D9cY-oa6Vc-RQ

    However there are other subtle differences between the blogger permalinks and wordpress ones. With the meta data already being there there is effectively a list of mappings which could be used by redirection so we don't actually need to know all these variations.

    I can see a couple of options here.

    1) Use that meta data to create simple redirections in the redirection_items table (perhaps just for the items that don't exist). I could do this using SQL queries but is there a better way? I've got 300 posts to handle but what about the people with really big sites?

    2) Extend the plugin so that's capable of looking at the the blogger permalink data in the post meta table.

  2. Workshopshed
    Member
    Posted 3 years ago #

    I've created the following SQL to extract the data using PHPMyAdmin

    SELECT CONCAT('/(.*)/',Replace(Right(meta_value,INSTR(Reverse(meta_value),'/')-1),'.html',''),'([^/]+)') AS Source,Concat('/$1/',p.Post_Name) as Dest
    FROM wp_postmeta AS m
    INNER JOIN wp_posts AS p ON m.post_id = p.id
    WHERE meta_key = 'blogger_permalink'
    AND meta_value <> '' and post_status = 'publish'
    and Replace(Right(meta_value,INSTR(Reverse(meta_value),'/')-1),'.html','') <> p.post_name

    The resulting records can be saved as CSV and then imported into the redirection plugin

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic