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]


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/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s