On 5 December 2013 17:09, Raphael R. O. <rabe...@gmail.com> wrote: > Hi guys, > > I'm trying to rewrite an url with a few parameters, but unsuccessfully.
You're almost there ;-) > What i already tried: > > rewrite > ^/category-body/categories/promotional(.*)utm_source=PromoCode&utm_medium=AddPromo&utm_campaign=PromoCode_AddPromo_moneycampainghttps://www.mysite.com.br/digital-parts/newspaper/recs-xyaw-sazz-qqad-cxae; "rewrite" doesn't examine query strings, so if the contents of your query string are required to drive your logic, you'll need to use other tools instead of (or well as) rewrite. > and ... > > location = /category-body/categories/promotional(.*)$ { You probably don't want the "=" here. I don't actually know what a regex ("(.*)") location used alongside "=" will do. I'm slightly surprised nginx didn't complain on reload/restart ... Have a read of this section: http://wiki.nginx.org/HttpCoreModule#location You probably want to use a case-sensitive regex location. > if ($args ~ > “utm_source=PromoCode&utm_medium=AddPromo&utm_campaign=PromoCode_AddPromo_moneycampaing”) I'd use a map{} variable inside the if(), personally. The map can use the same check as that which you have above, but in a way which abstracts the actual check away from the logic that it drives. This is just a stylistic change however :-) HTH, Jonathan _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx