Created
July 7, 2015 01:07
-
-
Save cihangir/01ef1c52110836cead3c to your computer and use it in GitHub Desktop.
Generic 301 re-direction
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
server { | |
# just a random port | |
listen 81; | |
# why we have 2 different if checks? because www redirector block catches | |
# all the requests, we should be more precise with the host | |
# redirect http://kodingen.com to https://koding.com | |
if ($host = "kodingen.com") { | |
return 301 https://koding.com; | |
} | |
# redirect http://www.kodingen.com to https://koding.com | |
if ($host = "www.kodingen.com") { | |
return 301 https://koding.com; | |
} | |
# use generic names, do not hardcode values | |
return 301 https://$host$request_uri; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment