Created
September 20, 2010 12:29
-
-
Save mudge/587828 to your computer and use it in GitHub Desktop.
Nginx configuration to redirect requests for non-existent files to an external URI without using if.
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
# Redirect all requests for non-existent files to another web | |
# site, used on my own site to redirect people to my GitHub | |
# account page. | |
server { | |
server_name example.com; | |
location / { | |
try_files $uri $uri/index.html @external; | |
} | |
location @external { | |
rewrite ^ $scheme://anotherexample.com$request_uri redirect; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment