Skip to content

Instantly share code, notes, and snippets.

@ryanscherler
Last active January 28, 2016 21:56
Show Gist options
  • Save ryanscherler/92e005ca8d33df6ac29c to your computer and use it in GitHub Desktop.
Save ryanscherler/92e005ca8d33df6ac29c to your computer and use it in GitHub Desktop.
ProcessWire - Redirect site files to production server for local development.
# -----------------------------------------------------------------------------------------------
# Redirects all file requests that do not exist locally to the production server
# -----------------------------------------------------------------------------------------------
# Force local files that exist to be generated.
RewriteCond %{REQUEST_URI} ^/site/assets/files/[^\/]*/((.*))$
RewriteCond %{DOCUMENT_ROOT}/site/assets/files/%1/%2 -f
RewriteRule ^(.*)$ $1 [QSA,L]
# Otherwise, send anything else that's in the files directory to the production server.
RewriteCond %{REQUEST_URI} ^/site/assets/files/[^\/]*/.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://www.breakthrough.org/$1 [QSA,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment