Skip to content

Instantly share code, notes, and snippets.

@petertoi
Last active January 18, 2018 21:14
Show Gist options
  • Save petertoi/57872d1107c5d3dd5832da7fec2d1cff to your computer and use it in GitHub Desktop.
Save petertoi/57872d1107c5d3dd5832da7fec2d1cff to your computer and use it in GitHub Desktop.
Nginx rewrite to request WordPress uploads from external domain
location ~ ^/wp-content/uploads/(.*) {
if (!-f $request_filename) {
rewrite ^/wp-content/uploads/(.*)$ http://EXTERNAL_URL/wp-content/uploads/$1 redirect;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment