Last active
December 12, 2015 12:09
-
-
Save faustman/4770362 to your computer and use it in GitHub Desktop.
Pass subdomain to rewrite rule. 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
# Redirect http://test.domain.com to http://domain.com/?utm_source=test&utm_medium=423525 | |
server { | |
listen 80; | |
server_name *.domain.com; | |
if ($host ~* ^([a-z0-9-\.]+)\.domain\.com$) { set $subdomain $1; } | |
rewrite ^ http://domain.com/?utm_source=$subdomain&utm_medium=$date_gmt permanent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment