rewrite rule

Igor Sysoev is at rambler-co.ru
Sun Mar 1 18:51:53 MSK 2009


On Sun, Mar 01, 2009 at 09:58:25PM +0800, Max wrote:

> I tried to change the following apache rewrite to work under nginx. But it's
> still not working.
> 
> RewriteEngine On
> RewriteBase /
> RewriteRule ^item-(.*)_(.*)_(.*)_(.*).html$
> auction.php?title=$1&item=$2&country=$3&ccid=$4
> RewriteRule ^item-(.*)_(.*)_(.*).html$
> auction.php?title=$1&item=$2&country=$3
> RewriteRule ^item-(.*)_(.*).html$ auction.php?title=$1&item=$2
> 
> Could anyone teach me how can I do it correctly? Thanks a lot.

      location /item- {
           rewrite  ^/item-(.*)_(.*)_(.*)_(.*).html$
                    /auction.php?title=$1&item=$2&country=$3&ccid=$4
                    last;

           rewrite  ^/item-(.*)_(.*)_(.*).html$
                    /auction.php?title=$1&item=$2&country=$3
                    last;

           rewrite  ^/item-(.*)_(.*).html$
                    /auction.php?title=$1&item=$2
                    last;
      }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list