Last active
April 19, 2023 06:39
-
-
Save zanematthew/0ba700c2b0e344fc94276d7b247bd1ed to your computer and use it in GitHub Desktop.
Nginx – Redirect WP uploads directory to another server.
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
#### | |
# | |
# Note this file should be place in: | |
# cd /etc/nginx/custom-sites/ | |
# Then be sure to restart nginx: | |
# $ sudo service nginx restart | |
location ~ ^/wp-content/uploads/(.*) { | |
if (!-f $request_filename) { | |
rewrite ^/wp-content/uploads/(.*)$ https://SOME-OTHER-URL-HERE.com/$1 redirect; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment