Created
May 28, 2020 02:47
-
-
Save morganestes/4048967703b8c78866181659805a1c9e to your computer and use it in GitHub Desktop.
WordPress image proxy for development
This file contains hidden or 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
| <IfModule mod_rewrite.c> | |
| RewriteEngine on | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule wp-content/uploads/(.*) https://example.com/wp-content/uploads/$1 [NC,L] | |
| </IfModule> |
This file contains hidden or 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
| set $production example.com; | |
| # Redirect requests to /wp-content/uploads/* to production server | |
| location @prod_uploads { | |
| rewrite "^(.*)/wp-content/uploads/(.*)$" "https://$production/wp-content/uploads/$2" break; | |
| } | |
| # Rule for handling requests to https://example.com/wp-content/uploads/ | |
| location ~ "^/wp-content/uploads/(.*)$" { | |
| try_files $uri @prod_uploads; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment