Batch redirect

7 months ago | Draky (Member) | |

Hello
I tried a blog conversion from DotClear (http://www.dotclear.net) to WP 2.5
All is OK except that DotClear handles post title differently from WP.
IE :
- DC => http://gilles.wittezaele.fr/blog/post/2008/01/31/Bonne-annee-2008-%3A-mieux-vaux-tard-que-jamais
- WP => http://gilles.wittezaele.fr/wordpress/post/2008/01/31/bonne-annee-2008-mieux-vaux-tard-que-jamais
As you can see, 2 points ":" are not handled the same way : DotClear convert them into ASCII codes I think whereas WP remove them.
Same goes for commas, etc.
So, before having a lot of 404 errors... I'd like to redirect automatically visitors using your plugin, with a batch redirect like "if there is a %3A- in the title of the asked post, redirect (301) them to the same name without %3A-.
Question : is it possible ?
Thanks :)

Read responses...

Responses

  1. John:

    Posted 7 months ago by Key Master

    It should be possible, yes. You could create a redirection like:

    Source: (.*)%3A\-(.*)
    Target: $1$2

    Regex power!

  2. Draky:

    Posted 6 months ago by Member

    Thanks a lot :)
    Seems your site is fixed :)

  3. monchito:

    Posted 5 months ago by Member

    Hi, LOVE this plugin, but do have a similar question:

    my old (custom built) blog has urls like: http://www.blog.com/logs/2008-05-28-logtitle/

    i've migrated to Wordpress and now want to use a different url structure and redirect all those post (800+) with a single regex. The new url structure is something like this: http://www.blog.com/category-name/logtitle.html

    As you see, a category name is added, the dates are stripped rom the url and instead of a trailing slash, the '.html' is added.

    So now i have two questions:
    1. is it possible to include the category name in the url somehow? (probably not i think?)
    2. how should the regex look like that strips the date part of the url and replaces the trailing slash with .html

    Thnx!

  4. monchito:

    Posted 5 months ago by Member

    Hi, i already found one part of the answer:

    source: /logs/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-(.*)/
    target: /$1.html

    This works fine, but does not yet take into account that a category (or even subcategories) are added :(

    I guess there should be some code that takes the new post slug (the (.*) part) , looks up the categories that should be added in the url and 301 redirects to the new url, including categories, so the target redirect would end up into something like this: target: /$category/$1.html

  5. monchito:

    Posted 5 months ago by Member

    Okay, finally found the answer. I decided to NOT include category names in the urls. That makes things a LOT easier. Also, it's better for SEO and usbaility, because people like short, easy urls.

Reply

You must log in to post.

Home | Software | Terms & Conditions | Sitemap | John Godley © 2008