Last active
December 22, 2015 03:29
-
-
Save richardsweeney/6410870 to your computer and use it in GitHub Desktop.
Proxy requests for files not found to production/staging server. Useful for working with WordPress (or Drupal, or whatever), so you don't have to download all uploaded files when you grab a production database.
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
RewriteCond %{HTTP_HOST} ([_0-9a-zA-Z-.]+)\.(dev|local)$ [NC] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule (.*) http://example.com/$1 [R=302,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you were to grab a WP install and DB from a production server. Import the DB, then '$ wp search-replace example.com example.dev' (if that's how you roll). Don't bother downloading all the files in wp-content/uploads/ just use this script to proxy the request to the production server. Mark Jaquith gave me the idea in a cool talk on deploying WordPress - http://wordpress.tv/2013/07/28/mark-jaquith-confident-commits-delightful-deploys-2/.
Legend