Request for a "no capture" rewrite directive enhancement

Igor Sysoev igor at
Wed May 28 04:44:07 UTC 2014

On 28 May 2014, at 03:52, Peter Mescalchin <peter.mescalchin at> wrote:

> Hello Nginx developers,
>    speaking to Maxim Konovalov over Twitter, suggested this would be the better place to get an answer to my suggestion.
> Basically what I would like to see is the ability to use a rewrite directive without the need to capture the current URI, which in turn overwrites $1,$2,$x captures made within a location directive.
> Best to explain via an example:
> As you can see, this works (and works well) but the need to use "set" to save copies of $1/$2 seems a little wasteful.
> Digging through the documentation I can't seem to find a way of using rewrite without blowing away/not capturing the current URI.

location ~ "^/[a-f0-9]{16}/(css|js)/(.+)" {
	expires 30d;
	alias  /path/to/$1/$2;

Igor Sysoev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list