X

Get Production Files If Not in Local Version

This snippet goes into an .htaccess file, filed under wp-content/uploads/

If you have a local “development” version of a WordPress site, and a production version of the same site on a live server, and the 2 should stay in sync, and also use the same database; BUT you don’t want to sync all the files that get added all the time (that just sucks).

THEN, this snippet can help you with that. What it does is it attempts to load files from production if they’re not in your local version.

Example: Client adds a new blog post with a photo attached to the live server. Since your local site is connected to the same database, the blog post will show up but the image doesn’t (since it’s uploaded to the live server and not your local computer).

You’ll get a 404 because http://local.sitename.com/wp-content/uploads/image.jpg doesn’t exist. But it does exist on http://sitename.com/wp-content/uploads/image.jpg. So, what this snippet does is it attempts to load files from production even if they’re not in your local version!

This scenario somewhat implies that you use version control GIT, and we recommend reading this article about Keeping WordPress Under Version Control: http://stevegrunwell.com/blog/keeping-wordpress-under-version-control-with-git

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!