Created
June 11, 2019 07:39
-
-
Save lynt-smitka/b8bf0a4b7e2a9e5802faa48ee16b19b0 to your computer and use it in GitHub Desktop.
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 ($query_string ~ "^(?<pre>.*?)(&?fbclid=[a-zA-Z0-9_-]+)(?<post>.*?)$"){ | |
rewrite ^(.*)$ $1?$pre$post?; | |
} | |
if ($query_string ~ "^(?<pre>.*?)(&?utm_source=[a-zA-Z0-9_-]+)(?<post>.*?)$"){ | |
rewrite ^(.*)$ $1?$pre$post?; | |
} | |
if ($query_string ~ "^(?<pre>.*?)(&?utm_medium=[a-zA-Z0-9_-]+)(?<post>.*?)$"){ | |
rewrite ^(.*)$ $1?$pre$post?; | |
} | |
if ($query_string ~ "^(?<pre>.*?)(&?utm_campaign=[a-zA-Z0-9_-]+)(?<post>.*?)$"){ | |
rewrite ^(.*)$ $1?$pre$post?; | |
} | |
if ($query_string ~ "^(?<pre>.*?)(&?utm_term=[a-zA-Z0-9_-]+)(?<post>.*?)$"){ | |
rewrite ^(.*)$ $1?$pre$post?; | |
} | |
if ($query_string ~ "^(?<pre>.*?)(&?utm_content=[a-zA-Z0-9_-]+)(?<post>.*?)$"){ | |
rewrite ^(.*)$ $1?$pre$post?; | |
} | |
if ($query_string ~ "^(?<pre>.*?)(&?gclid=[a-zA-Z0-9_-]+)(?<post>.*?)$"){ | |
rewrite ^(.*)$ $1?$pre$post?; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@lynt-smitka Your nginx config will cause 500 error if nginx rewrite more than 10x.
Read it here:
=> http://nginx.org/en/docs/http/ngx_http_core_module.html#internal
For example: example.com/?gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222&gclid=222