Old links does not work after Changing my Own Directory and permalinks (2 posts)

  1. elitost
    Posted 7 years ago #


    I changed my Own Directory with the procedure described in the Help section, now my blog is accessible with :


    instead of :


    And after I recalculated the permalinks :


    Now, my problem is, for each old links without permalink calculation i have a 404 error :


    This error happens on my internal links I used in my post, but also for all the previous links indexed by Google, Yahoo...

    What can I do to solve the problem ?

    Thanks by advance

  2. Austin Matzko
    Posted 7 years ago #

    There are at least two ways to fix your internal links. (This won't fix the indexed links of Google).

    The first, easiest and safest, is to replace the text on output. One way to do this is to put the following line in your theme's functions.php template:

    add_filter('the_content', create_function('$a','return str_replace("http://ericreboisson.free.fr/wordpress","http://ericreboisson.free.fr",$a);'));

    The second, permanent and more dangerous, is to replace the text in your database. I say dangerous, because if you mess this up, you could really mess up your posts. You must back up your database before trying this, and you shouldn't attempt it if you feel uncomfortable at all about it. I'm telling you how to do it, not saying that you should.

    If you did this, you would run the following query, using phpMyAdmin or the like:

    UPDATE wp_posts SET post_content=REPLACE(post_content, "http://ericreboisson.free.fr/wordpress","http://ericreboisson.free.fr");

Topic Closed

This topic has been closed to new replies.

About this Topic