Created
July 13, 2012 20:42
-
-
Save jondavidjohn/3107336 to your computer and use it in GitHub Desktop.
Rewrite Wordpress uploads to lorempixel (Nginx)
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
# if you're requesting anything within '/wp-content/uploads' or '/files' | |
location ~ (/wp-content/uploads|files) { | |
# and it doesn't exist | |
if (!-e $document_root$uri) { | |
# try and match the dimensions from the filename | |
rewrite (\d+)(?:x)(\d+)(?:\.(?:[^\.]+)$) http://lorempixel.com/$1/$2 break; | |
# otherwise just use a default size | |
rewrite .* http://lorempixel.com/800/600 break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment