# Nginx rewrite bug

**URL:** <https://www.ruby-forum.com/t/nginx-rewrite-bug/188926>\
**Category:** NGINX\
**Created:** [May 20, 2010, 5:03pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-bug/188926 "2010-05-20T17:03:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![val\_lee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c5a1d2/32.png) [@val\_lee](https://www.ruby-forum.com/u/val_lee)\
**Post date:** [May 20, 2010, 5:03pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-bug/188926/1 "2010-05-20T17:03:25Z")

</div>

nginx version:0.8.37  
I write:  
rewrite  
^/page([0-9]+)-t([a-zA-Z]+)-g([0-9]+)-t([0-9]+)-a([0-9]+)-s([0-9]+)-p([0-9]+)-t([0-9]+)-o(.+)-w(.\*).html$  
/search/search.do?pg=$1&tp=$2&gm=$3&ts=$4&aa=$5&sr=$6&pz=$7&type=$8&ord=$9&wd=$10  
last;

$10 is rewrited $1 and 0.Don’t nginx supports $10 or $11…?  
But i see [http://aleksandarsavic.com/](http://aleksandarsavic.com/)

Nginx rewrite rules for XtraUpload:  
if (!-e $request\_filename) {

# New Rewrite Rules for total site SEO

rewrite  
^/(._)/(._)_(.)/(.)_(._)/(._)_(.)/(.)_(._)/(._)\_(.\*)/index.htm$  
/$1.php?$2=$3&$4=$5&$6=$7&$8=$9&$10=$11 last;  
…

---

<div class="post-metadata">

**Author:** ![val\_lee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c5a1d2/32.png) [@val\_lee](https://www.ruby-forum.com/u/val_lee)\
**Post date:** [May 20, 2010, 5:51pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-bug/188926/2 "2010-05-20T17:51:26Z")

</div>

On Thu, May 20, 2010 at 11:02:14PM +0800, val lee wrote:

> if (!-e $request\_filename) {
> 
> # New Rewrite Rules for total site SEO
> 
> rewrite ^/(._)/(._)_(.)/(.)_(._)/(._)_(.)/(.)_(._)/(._)\_(.\*)/index.htm$  
> /$1.php?$2=$3&$4=$5&$6=$7&$8=$9&$10=$11 last;  
> …

Yes, nginx does not support $10 and $11, but you may use named captures:

```
 ... -o(.+)-w(?<n0>.*)\.html$

 ... &ord=$9&wd=$n0

```

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
