ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nginx регулярные выражени я



On Tue, Aug 23, 2011 at 12:33:37PM +0400, Anton Yuzhaninov wrote:
> On 08/23/11 11:31, quux wrote:
> > У меня такая проблема: нужно чтобы
> > http://domain.com/anchor/value
> > перенаправлялось на
> > http://domain.com/script.php?value
> >
> > location /anchor/ {
> >                 rewrite /anchor/(.*)$ http://domain.com/script.php?$1;
> > }
> >
> > переделывает адресную строку в
> > браузере. А хотелось бы чтоб адресная
> > строка в браузере так и оставалась вида
> > http://domain.com/anchor/value
> 
> Наверно у вас php проксируется на какой то бэкенд (по http или fastcgi), 
> тогда 
> можно сделать как то так:
> 
> location ~ ^/anchor/(?<value>.*)$ {
>     proxy_pass http://127.0.0.1:8080/script.php?$value;
> }

Не забываем о локализации регулярных выражений:

location /anchor/ {
    location ~ ^/anchor/(?<value>.*)$ {
        proxy_pass http://127.0.0.1:8080/script.php?$value;
    }
}


-- 
Игорь Сысоев
http://sysoev.ru

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.