• webfeed

    (@webfeed)


    I recently moved my site to a new server. The only thing that I can’t get to work is the old permalink structure. I’ve added some permanent redirects in .htaccess to some of the more “popular” posts, for the new structure.

    I’d like to create a re-write or redirect that will make all of the incoming links redirect to the new permalink structure.

    Here’s an example of what I need to do:
    Old structure (incoming links from other sites point to this):
    http://webfeedcentral.com/index.php/archives/2006/02/10/looking-for-a-new-server/

    New structure:
    http://webfeedcentral.com/2006/02/10/looking-for-a-new-server/

    I just need to strip out the “index.php/archives/” part, and redirect it to the new address. I think that there “should” be a way to do this in .htaccess, but I haven’t been able to find any references on how to do it.

    If there’s another solution, I’m all ears.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter webfeed

    (@webfeed)

    I should also mention that the blog is about 2 years old and has almost 500 posts, so redirecting each one, individually would be way too time consuming.

    I’ve heard of this problem a lot, but until now I’ve never heard a good solution. there may be one, but I’ve never heard of it

    I have this very same problem, but no solution.

    ABOVE your WordPress rules in your .htaccess file, this will probably do I think:

    RewriteEngine On
    RewriteRule ^index.php/archives/(.+) http: //webfeedcentral.com/$1

    (remove the space/line break after http:)

    That worked great, thank you so very much.

    -Steve

    No prob. 🙂

    Thread Starter webfeed

    (@webfeed)

    Thank you for your help on this! I was starting to wonder if this was even possible.

    Could I use this technique to change my old numerical permalinks (still hanging on from my the CMS I used before WordPress):

    http://www.mothugg.se/item/737

    to something fancier and SEO-friendlier like:

    http://www.mothugg.se/fri-forskning-nastan-som-fildelning?

    Or is there some plugin to do that?

    Add this to the VERY top of your theme’s 404 page.
    Change http://localhost/wordpress to your default wordpress folder.
    This just does posts and possibly pages that end in the id (with or without the trailing url) Categories etc will have to be done elsewhere or by hand.
    <?php
    //Kinda obvious
    $rf = $_SERVER[‘REQUEST_URI’];
    $rf = explode(‘/’,$rf);
    $last = count($rf);
    //Filter out regular 404 that arn’t old urls
    if(is_numeric($rf[$last-1])){
    $post_id = $rf[$last-1];
    }elseif(is_numeric($rf[$last-2])){
    $post_id = $rf[$last-2];
    }
    // No sense loading WP if there isn’t an id
    if ( $post_id ) {
    // Oh fine we will load wordpress
    define(‘WP_USE_THEMES’, false);

    require(‘http://localhost/wordpress/wp-blog-header.php&#8217;);
    $post = get_post($post_id);
    //Well hope it is the right post. If not, ohwell. We tried.
    if($post){
    //Lets get the new URL
    $new_link = get_permalink($post_id);
    //We don’t want google to get angry with us.
    header(“HTTP/1.1 301 Moved Permanently”);
    header(“Location: $new_link”);
    }
    }
    ?>

    Hello same here…
    I want to change my permalinks from
    http://www.enblogopedia.com/2007/02/10/what-ever/
    to:
    http://www.enblogopedia.com/what-ever/

    isn’t redirecting through .htaccess better than the way “Ajd777” suggests ?!
    I believe the code will be something like this:

    RewriteEngine On
    RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.+) http: //www.enblogopedia.com/$1

    (of course with out the line break!)
    Am I right?!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Redirecting To A New Permalink Structure’ is closed to new replies.