Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help - rewrite from apache to nginx
On Sun, Jul 18, 2010 at 08:22:35PM +0300, Veaceslav Grecea wrote:
> Здравствуйте.
>
> Есть вот такие реврайт правила:
>
> RewriteRule detail-property-results-([0-9]+).php$
> /results_detail.php?pageindex=$1&lang=en
> [NC,L]
> RewriteRule detail-property-results.php$
> /results_detail.php
> [NC,L]
> RewriteRule property/([0-9]+)/(.*).php$
> property-detail-2?propertyid=$1&lang=$2
> [R,L]
> RewriteRule property-results-([0-9]+).php$
> /results.php?pageindex=$1&lang=en
> [NC,L]
> RewriteRule property-results.php$
> /results.php?lang=en [NC,L]
>
> Я уже день мучаюсь и никак не могу перенести их под локейшены nginx-а.
> Хотя бы пример по первому правилу.
Я бы сделал так (писать больше, зато сопровождать легче):
location /detail-property-results {
location = /detail-property-results.php {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results_detail.php;
fastcgi_param QUERY_STIRNG "";
include fastcgi_params0;
}
location ~ ^/detail-property-results-([0-9]+)\.php$ {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results_detail.php;
fastcgi_param QUERY_STIRNG pageindex=$1&lang=en;
include fastcgi_params0;
}
return 404;
}
location /property-results {
location = /property-results.php {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results.php;
fastcgi_param QUERY_STIRNG lang=en;
include fastcgi_params0;
}
location ~ ^/property-results-([0-9]+)\.php$ {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results.php;
fastcgi_param QUERY_STIRNG pageindex=$1&lang=en;
include fastcgi_params0;
}
return 404;
}
location /property/ {
location ~ ^/property/([0-9]+)/(.*)\.php$ {
return http://$host/property-detail-2?propertyid=$1&lang=$2;
}
return 404;
}
--
Игорь Сысоев
http://sysoev.ru
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|