My images are currently externally linked to my blogger account. After importing everything through PowerPress, it imported all my images like this:

<div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-YrjQLYBicjE/Wl19tTXO1mI/AAAAAAAAneY/ulQf9voxKGo0CTZFb4Xi96Lk0mFS2purwCLcBGAs/s1600/95DD6994-4A23-4B1C-A333-F5352B5A3B04.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1200" height="400" src="https://1.bp.blogspot.com/-YrjQLYBicjE/Wl19tTXO1mI/AAAAAAAAneY/ulQf9voxKGo0CTZFb4Xi96Lk0mFS2purwCLcBGAs/s400/95DD6994-4A23-4B1C-A333-F5352B5A3B04.jpeg" width="400" /></a></div>

Is there any kind of .htaccess code that will let me change the /s400 to /s1600 so that the right size image is being displayed on my site without having to edit each post individually?


Since the request is sending to the blogspot server, no .htaccess wont wont.

You could filter your post content output:

add_filter('the_content', function($the_content) {
    return str_replace('/s400','/s1600',$the_content);

Or you could edit modify the database

global $wpdb;

$wpdb->query("UPDATE $wpdb->posts SET `post_content` = REPLACE(`post_content`,'/s400','/s1600');"); 

Or do it in mysql

UPDATE wp_posts SET `post_content` = REPLACE(`post_content`,'/s400','/s1600';

assuming wp_posts is your posts table.

Or you could use wpcli

wp search-replace '/s400' '/s1600'

If you modify the database tho any of the methods, be sure to always backup the database before hand.

(Before anyone else dismisses my answer, please note that what I've provided would be an answer to your question, but it's a bandaid fix to the real problem: the images aren't in Wordpress and probably should be.

| improve this answer | |
  • 1
    Yes, great answer but maybe he should better use the Import External Images plugin to import the images within WordPress. it.wordpress.org/plugins/import-external-images – Stefano Tombolini Mar 22 '18 at 7:40
  • 1
    yes, absolutely. Didn't know that existed but thats exactly what's needed. – David Sword Mar 22 '18 at 16:03
  • I actually did end up just moving all the images over manually. But this did work, just not for everything I needed. – Kelen Conley May 3 '18 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.