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?

1 Answer
1

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.

Leave a Reply

Your email address will not be published. Required fields are marked *