Mock production uploads for parity purposes
malarstrom opened this issue · comments
Mikael Mälarström commented
This isn't obvious to everyone. So here's a tip!
If you'd like to mock the uploads of the production environment of the site you are working on. Then just (so you don't have to use a local copy of the production uploads):
- Create
~/data/{CONTAINER}/wp-content/uploads/.htaccess
containing (before wp directive):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://{PRODUCTION_URI}/wp-content/uploads/$1
</IfModule>
All uploads with local file paths will now be served from the production site.
If you by any reason have a different structure for the uploads folder, just change it in the rule
Enjoy!