Point Local WordPress Uploads at Live URL

When working on large WordPress sites that have a very big uploads directory that is regularly updated and added to. I did not want to have to download the content via FTP every-time I wanted to work on the site locally.

I used the following rewrite rule, placed in a .htaccess file in my wp-content/uploads folder.

<IfModule mod_rewrite.c>
 RewriteEngine On

 RewriteBase /wp-content/uploads/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*) http://your-site.com/wp-content/uploads/$1 [L,P]

</IfModule>

This looks to see if a file exists locally if not it shows a remote one.

You need to make sure you set both the RewriteBase (line 3) and RewriteRule (line 6) to match your environment.

Source: http://polevaultweb.com/2014/03/5-ways-synchronise-wordpress-uploads-across-environments/

One thought on “Point Local WordPress Uploads at Live URL”

Leave a comment