Support » Networking WordPress » No more featured image thumbnails after db prefix change

  • Hi,

    To improve security, I decided to change the database prefix for our wordpress installation from wp_ to our custom code.

    Everything works well, except that for the WordPress sites in subfolders, the featured image thumbnails have disappeared. The images are still there on the server, in the ‘blogs-dir’ folder. The thumbnails are still there in the main blog.

    When I try to open the images in the backend, there is no thumbnail there, but when I click ‘edit image’, the image appears. So WordPress definitely can find the images.

    Any idea how to fix this?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Not sure what might have happened, but maybe you can try the Regenerate Thumbnails plugin to see if that fixes the issue.

    I tried three plugins to rebuild/regenerate/force regenerate thumbnails. No effect.

    Deleting the featured image and trying to add it again also has no effect. (But only in the subfolder blogs).

    Any other ideas?

    What’s your custom code? If it ends in a number, that might be why…

    Also did you search/replace the whole DB to fix everything?

    Custom code doesn’t end in a number, it’s hxlblog_

    I replaced all table prefixes starting with wp_ and all options in wp_options table and wp_usermeta table. (I did all the steps as described in this post)

    I did exactly the same for wp_ (main blog) and wp_2_ and wp_3_, so if it works on the main blog, then the database must be correct, I presume?

    This is something I noticed: on the main site, the thumbnails work and the path to the image is for example …wp/wp-content/uploads/2012/08/…, the actual path on the server.

    On the 2nd and 3rd site, the path is for example …wp/en/files/2012/09/… while the actual location is …wp/wp-content/blogs.dir/files/2012/09… Maybe something is wrong with the link?

    No, that’s how it’s supposed to work.

    In your .htaccess, you should have this:

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    And that should redirect you just fine.

    Check that your full .htaccess is something like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    I did exactly the same for wp_ (main blog) and wp_2_ and wp_3_, so if it works on the main blog, then the database must be correct, I presume?

    No, actually. All that means is you did the main blog correctly.

    This step:

    4- Edit wp_options

    Then you need to edit in the op2mro445_options table ( formaly wp_options ) table

    Click on the table name link and then click on β€œBrowse” menu item.
    You will see all the data stored in that table. Look under the option_name column header and change wp_user_roles to op2mro445_user_roles.
    You will be able to change it by clicking on the edit button for that record.

    Note: wp_user_roles might not appear on the 1st page under options. Keep looking for it, otherwise you will not be able to login afterwards.

    has to be repeated for every site on your network. Did you do that?

    Yes .htaccess looks exactly the same, and I repeated the steps for prefix change for all the sites in the network, including the wp_options table…

    So this seems like a very strange thing… If there are no other options, I will maybe have to try to disable multisite and then reinstall the extra blogs in the network and importing blog posts again?

    Oooh. Wait. You didn’t do a DB wide search/replace did you? You did ’em one table at a time, and only for those wp_x_options tables?

    Yes that’s how I did it. No search and replace, but the steps as described here, for all blogs in the network.

    Just to be 100% clear, you mean “Yes, I searched each table, one at a time, to replace the data.”

    I know what the URL says but since I also know you had to extrapolate for Multisite, I’m going to be pedantic to make sure I understand what you did πŸ™‚ I asked because a sitewide search and replace would screw up your data serialization, which could do this to you.

    Yes indeed, I searched each table, including for the other blogs in the network, one at a time, to replace the data.
    Good to be clear πŸ™‚

    Darn, that was the last idea I had about how that could have gone weird πŸ™

    OK thanks for your input anyways… I’ll see if I can delete the subfolder blogs and then reinstall everything, when I have time for that.

    Solution found. The problem was caused by another security measure.

    In the wp-includes folder, folowing .htaccess file was placed by a security plugin:

    <Files *.php>
    deny from all
    <Files wp-tinymce.php>
    allow from all

    I removed this .htaccess file and now the thumbnails work again on the subfolder blogs.

    Was that by sucuri?

    Yes, that’s the one.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘No more featured image thumbnails after db prefix change’ is closed to new replies.