NGINX

Remove query parameters in Nginx

by ,


We have by far the largest RPM repository with dynamic stable NGINX modules and VMODs for Varnish 4.1 and 6.0 LTS. If you want to install NGINX, Varnish, and lots of useful modules for them, this is your one-stop repository to get all performance-related software.
You have to maintain an active subscription in order to be able to use the repository!

Sometimes you want to make Nginx ignore a parameter passed in page request.

Here is a short snippet to do that:

if ($query_string ~ "^(.*)gclid=(.*)$") {
    rewrite ^(.*)$ $uri? permanent;
}

This comes useful in case you run a Magento store with some SEO plugins that redirect to base URL of every page, but want the specific parameter (gclid in this case) to be retained, for integration with Javascript code (Google Analytics).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.