WordPress.org

Ready to get started?Download WordPress

Forums

cutenews to wordpress redirecting old urls (3 posts)

  1. MarkDefacto
    Member
    Posted 7 years ago #

    I have a cutenews blog I am trying to convert to wordpress but for the life of me can't get the old cutenews urls to redirect to the new wordpress ones. There are only 34 pages so I am doing this manually. I want to forward a cutenews url like http://www.someplace.com/?subaction=showfull&id=3141592653&archive=&start_from=&ucat=1& to the new, wordpress one at http://www.someplace.com/a-new-url/ so the code I tried was

    [code]
    RewriteRule ^(.*)3141592653(.*)$ http://www.someplace.com/a-new-url/ [R=301,L]
    [/code]

    This does not work, it will not forward the url. If I take the question mark out of the original cutenews url it forwards fine. I tried escaping the question mark in the rule, and I tried putting it in like a normal character but it will not work. Is there something special about a question mark so that it won't forward?

    Now if I can't get any of this to work, I might have to change the page and post ids of wordpress to match the ids of cutenews. Is there any reason I can't do this or anything I should look out for? How should I do the Rewrite rule if I do that?

  2. MarkDefacto
    Member
    Posted 7 years ago #

    No one ever responded but here is the solution I came up with. I found what things are unique to cutenews and won't appear in a wordpress url and wrote something in .htaccess. It captures the unique article id or the unique category id from cutenews and passes them to a php script I made called cutenewsredirect.php. cutenewsredirect.php in turn redirects them to the correct website giving the 301 (moved permanently) status.

    .htaccess:

    # redirect the old cutenews articles
    RewriteCond %{QUERY_STRING} (.*)(subaction|start_from)(.*)id=([0-9]+)(.*)
    RewriteRule ^.* http://www.newsite.com/cutenewsredirect.php?article=%4 [L]
    
    # redirect the old cutenews categories
    RewriteCond %{QUERY_STRING} (.*)category=([0-9]+)(.*)
    RewriteRule ^.* http://www.newsite.com/cutenewsredirect.php?cutecats=%2 [L]

    cutenewsredirect.php:

    <?php
    switch ($_GET["article"])
    {
            case "3141592":
                    Header("HTTP/1.1 301 Moved Permanently");
                    Header("Location: http://www.newsite.com/pi-is-great");
            break;
    
            case "8675309":
                    Header("HTTP/1.1 301 Moved Permanently");
                    Header("Location: http://www.newsite.com/a-new-page/");
            break;
    
    }
    switch ($_GET["cutecats"])
    {
            case "1":
                    Header("HTTP/1.1 301 Moved Permanently");
                    Header("Location: http://www.newsite.com/category/foobar/");
            break;
    }
    
    ?>
  3. stopha
    Member
    Posted 7 years ago #

    HI - Is there a guide to converting Cutenews to wordpress? I can't find anything as of right now, seems the cutenews developer site is not functioning.

    Thanks!!

Topic Closed

This topic has been closed to new replies.

About this Topic