While modifying clients WordPress sites I don’t download the uploads directory contents so to avoid 404s in Chrome’s Developer Tools console I modified .htaccess
to redirect those URLs to the live site. Tested in a docker container.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{SERVER_NAME} localhost | |
RewriteRule ^wp-content/uploads/(.+)$ http://www.example.com/wp-content/uploads/$1 [R=301,L] | |
</IfModule> |