Support » Fixing WordPress » redirects ??

  • WordPress is added onto my existing site, its hosted on the same server but managed separately as just a blog.

    I have just made a major change to the folder structure of my site, i changed one of the folder names. Within my blog it is referring to the old structure in some posts. Whats the easiest way to let wordpress know that i’ve changed things around so that it can change the URLs within the blog where needed??

Viewing 1 replies (of 1 total)
  • Hi

    This will not happen automatically. You have to change them. It can be done with a “replace” SQL query in phpMyAdmin.

    1) BACKUP YOUR DATABASE!!!! easiest – install the wp-db-backup plugin http://wordpress.org/extend/plugins/wp-db-backup/

    2) this example assumes
    -the old location was http://mydomain.com/wordpress
    -your theme was in http://mydomain.com/wordpress/wp-content/themes/mytheme.
    – images were in http://mydomain.com/wordpress/wp-content/uploads

    the new locations:
    http://mydomain.com/blog
    – theme: http://mydomain.com/blog/wp-content/themes/mytheme.
    – images: http://mydomain.com/blog/wp-content/uploads

    Assuming the name of your posts table is wp_posts. If using a prefix other than wp_ then replace wp_posts with actual posts table name.

    Go to SQL tab in phpMyAdmin. We will run two SQL statements one first, followed by the second:

    UPDATE wp_posts SET post_content = replace(post_content, 'mydomain.com/wordpress', 'mydomain.com/blog');
    
    UPDATE wp_posts SET post_content = replace(post_content, '/wordpress/wp-content', '/blog/wp-content');

    This code says, find all occurrences of the string mydomain.com/wordpress in the post_content field of the posts table and replace them with mydomain.com/blog

    Two statements are needed because there are various ways “wordpress” is referred to in the post code. If we just replaced all occurrences of “wordpress” with “blog” we are potentially changing it in a lot of places that have nothing to do with a file path.

    You will be substituting your domain and install folder for “mydomain.com” and “wordpress” and “blog” (the old and new install folders, respectively).

    3) DID YOU REMEMBER TO BACKUP YOUR DATABASE BEFORE YOU DID THIS? BACK UP YOUR DATABASE!!!

Viewing 1 replies (of 1 total)
  • The topic ‘redirects ??’ is closed to new replies.