Skip to content

Instantly share code, notes, and snippets.

@michaelkarrer81
Last active November 9, 2016 12:54
Show Gist options
  • Save michaelkarrer81/9c3545f04be64fc90464fdb4d8a01984 to your computer and use it in GitHub Desktop.
Save michaelkarrer81/9c3545f04be64fc90464fdb4d8a01984 to your computer and use it in GitHub Desktop.
Nginx retain query!
location /some/location {
# check, if any query strings are available
if( $args = '' ) {
# no query found, so...
return 301 /destination/url/;
}
# if it reaches here, then query is found, so...
return 301 /destination/url/?$args;
}
#Even better:
location /some/location {
return 301 /destination/url/$is_args$args;
}
@michaelkarrer81
Copy link
Author

Even better:

location /some/location {
return 301 /destination/url/$is_args$args;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment