WordPress generates various image sizes for each picture you upload using Media size settings. The plugins and themes can also add additional media sizes. This is a really good feature because it helps your site load faster by loading smaller image sizes for post thumbnails.

But, if you remove those images or clean them using a plugin, then you will need to redirect old image sizes to the full size to keep your site functioning.

Redirect Missing Image Sizes Using .htaccess

You can use the following htaccess code to redirect all your missing image sizes to full size.

# Fix for missing media sizes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wp-content/uploads/(.*)-\d{2,4}x\d{2,4}.jpg https://example.com/wp-content/uploads/$1.jpg [L,R=301,NC]
RewriteRule ^wp-content/uploads/(.*)-\d{2,4}x\d{2,4}.webp https://example.com/wp-content/uploads/$1.webp [L,R=301,NC]
RewriteRule ^wp-content/uploads/(.*)-\d{2,4}x\d{2,4}.png https://example.com/wp-content/uploads/$1.png [L,R=301,NC]