Nginx Rewrite

Francis Daly francis at
Thu Feb 5 18:16:15 UTC 2015

On Thu, Feb 05, 2015 at 12:16:27PM -0500, ntamblyn wrote:

Hi there,

> How can i turn this into a rewrite i have include what i have tried

"rewrite" matches a request uri, the same as "location" does. This does
not include the query string.

> I have tried 
> rewrite  /test/c_(.*)\?change_lang   /test/e_$1  redirect; 
> but that doesnt work 

If "rewrite" is the right tool, a way to use it here is

  if ($args = "change_lang") {
    rewrite  ^/test/c_(.*)   /test/e_$1?  redirect;

Francis Daly        francis at

More information about the nginx mailing list