fbpx

NGINX

Remove query parameters in Nginx

by ,


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

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

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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