ПРОЕКТЫ 


  АРХИВ 


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: Ошибка 500 Internal server error при настройка редиректов



On Thursday 10 April 2014 07:08:58 a1235530 wrote:
> Доброго времени суток! Пытаюсь настроить редирект для повторяющегося get
> параметра. Например ссылка:
> 
> http://site.ru/katalog/CD11104/?s-price-min=10&s-price-max=50&s-configurator-1000=500&и
> еще несколько s-configurator-x=y?s-cat_id=100
> 
> Должна превратиться в ссылку
> 
> http://site.ru/katalog/CD11104/100/100-500/id configurator-значение/id
> configurator-значение/и тд/price-min/price-max/
> 
> Вот правила:
> 
>       if ($query_string ~
> "^s-price-min=(.*)&s-price-max=(.*)&s-configurator-(.*)=(.*)&s-cat_id=(.*)")
{
>               set $cat_1 $1;
>               set $cat_2 $2;
>               set $cat_3 $3;
>               set $cat_4 $4;
>               set $cat_5 $5;
>               rewrite /katalog/([^\/]*)\/(.*)
> /katalog/$1/$cat_5/$cat_3-$cat_4/pmin$cat_1/pmax$cat_2/? permanent; 
>       }
> 
>       if ($query_string ~
> "^s-price-min=(.*)&s-price-max=(.*)&s-configurator-(.*)=(.*)&s-
configurator-(.*)=(.*)&s-cat_id=(.*)"){
>               set $cat_1 $1;
>               set $cat_2 $2;
>               set $cat_3 $3;
>               set $cat_4 $4;
>               set $cat_5 $5;
>               set $cat_6 $6;
>               set $cat_7 $7;
>               rewrite /katalog/([^\/]*)\/(.*)
> /katalog/$1/$cat_7/$cat_3-$cat_4/$cat_5-$cat_6/pmin$cat_1/pmax$cat_2/?
> permanent; 
>       }
> 
> и тд.
> 
>       rewrite
> 
^/katalog/([^\/]*)\/([^\/]*)\/([^\/]*)-([^\/]*)\/([^\/]*)-([^\/]*)\/pmin(.*)/pmax(.*)/?
$
> /index.php?/katalog/$1/&s-price-min=$7&s-price-max=$8&s-
configurator-$3=$4&s-configurator-$5=$6&s-cat_id=$2?
> break;
>       
> 
>       rewrite
> ^/katalog/([^\/]*)\/([^\/]*)\/([^\/]*)-([^\/]*)\/pmin(.*)/pmax(.*)/?$
> /index.php?/katalog/$1/&s-price-min=$5&s-price-max=$6&s-
configurator-$3=$4&s-cat_id=$2?
> break;
> 
> и тд.
> 
> Вроде все работает, но когда доходит до 13 параметра
> 
>       if ($query_string ~
> "^s-price-min=(.*)&s-price-max=(.*)&s-configurator-(.*)=(.*)&s-
configurator-(.*)=(.*)&s-configurator-(.*)=(.*)&s-
configurator-(?<n0>.*)=(?<n1>.*)&s-configurator-(?<n2>.*)=(?<n3>.*)&s-
configurator-(?<n4>.*)=(?<n5>.*)&s-configurator-(?<n6>.*)=(?<n7>.*)&s-
configurator-(?<n8>.*)=(?<n9>.*)&s-configurator-(?<a0>.*)=(?<a1>.*)&s-
configurator-(?<a2>.*)=(?<a3>.*)&s-configurator-(?<a4>.*)=(?<a5>.*)&s-
configurator-(?<a6>.*)=(?<a7>.*)&s-configurator-(?<a8>.*)=(?<a9>.*)&s-
configurator-(?<b0>.*)=(?<b1>.*)&s-configurator-(?<b2>.*)=(?<b3>.*)&s-
configurator-(?<b4>.*)=(?<b5>.*)&s-configurator-(?<b6>.*)=(?<b7>.*)&s-
configurator-(?<b8>.*)=(?<b9>.*)&s-configurator-(?<c0>.*)=(?<c1>.*)&s-
configurator-(?<c2>.*)=(?<c3>.*)&s-cat_id=(.*)"){
>               set $cat_1 $1;
>               set $cat_2 $2;
>               set $cat_3 $3;
>               set $cat_4 $4;
>               set $cat_5 $5;
>               set $cat_6 $6;
>               set $cat_7 $7;
>               set $cat_8 $8;
>               set $cat_9 $9;
>               set $cat_10 $n0;
>               set $cat_11 $n1;
>               set $cat_12 $n2;
>               set $cat_13 $n3;
>               set $cat_14 $n4;
>               set $cat_15 $n5;
>               set $cat_16 $n6;
>               set $cat_17 $n7;
>               set $cat_18 $n8;
>               set $cat_19 $n9;
>               set $cat_20 $a0;
>               set $cat_21 $a1;
>               set $cat_22 $a2;
>               set $cat_23 $a3;
>               set $cat_24 $a4;
>               set $cat_25 $a5;
>               set $cat_26 $a6;
>               set $cat_27 $a7;
>               set $cat_28 $a8;
>               set $cat_29 $a9;
>               set $cat_30 $b0;
>               set $cat_31 $b1;
>               set $cat_32 $b2;
>               set $cat_33 $b3;
>               set $cat_34 $b4;
>               set $cat_35 $b5;
>               set $cat_36 $b6;
>               set $cat_37 $b7;
>               set $cat_38 $b8;
>               set $cat_39 $b9;
>               set $cat_40 $c0;
>               set $cat_41 $c1;
>               set $cat_42 $c2;
>               set $cat_43 $c3;
>               rewrite /katalog/([^\/]*)\/(.*)
> 
/katalog/$1/$cat_9/$cat_3-$cat_4/$cat_5-$cat_6/$cat_7-$cat_8/$cat_10-$cat_11/$cat_12-$cat_13/$cat_14-$cat_15/$cat_16-$cat_17/$cat_18-$cat_19/$cat_20-$cat_21/$cat_22-$cat_23/$cat_24-$cat_25/$cat_26-$cat_27/$cat_28-$cat_29/$cat_30-$cat_31/$cat_32-$cat_33/$cat_34-$cat_35/$cat_36-$cat_37/$cat_38-$cat_39/$cat_40-$cat_41/$cat_42-$cat_43/pmin$cat_1/pmax$cat_2/?
> permanent; 
>       }
> 
> и
> 
>       rewrite
> 
^/katalog/([^\/]*)\/([^\/]*)\/([^\/]*)-([^\/]*)\/([^\/]*)-([^\/]*)\/([^\/]*)-([^\/]*)\/([^\/]*)-(?<n0>[^\/]*)\/(?<n1>[^\/]*)-(?<n2>[^\/]*)\/(?<n3>[^\/]*)-(?<n4>[^\/]*)\/(?<n5>[^\/]*)-(?<n6>[^\/]*)\/(?<n7>[^\/]*)-(?<n8>[^\/]*)\/(?<n9>[^\/]*)-(?<a0>[^\/]*)\/(?<a1>[^\/]*)-(?<a2>[^\/]*)\/(?<a3>[^\/]*)-(?<a4>[^\/]*)\/(?<a5>[^\/]*)-(?<a6>[^\/]*)\/(?<a7>[^\/]*)-(?<a8>[^\/]*)\/(?<a9>[^\/]*)-(?<b0>[^\/]*)\/(?<b1>[^\/]*)-(?<b2>[^\/]*)\/(?<b3>[^\/]*)-(?<b4>[^\/]*)\/(?<b5>[^\/]*)-(?<b6>[^\/]*)\/(?<b7>[^\/]*)-(?<b8>[^\/]*)\/(?<b9>[^\/]*)-(?<c0>[^\/]*)\/(?<c1>[^\/]*)-(?<c2>[^\/]*)\/pmin(?<c3>.*)/pmax(?<c4>.*)/?
$
> /index.php?/katalog/$1/&s-price-min=$c3&s-price-max=$c4&s-
configurator-$3=$4&s-configurator-$5=$6&s-configurator-$7=$8&s-
configurator-$9=$n0&s-configurator-$n1=$n2&s-configurator-$n3=$n4&s-
configurator-$n5=$n6&s-configurator-$n7=$n8&s-configurator-$n9=$a0&s-
configurator-$a1=$a2&s-configurator-$a3=$a4&s-configurator-$a5=$a6&s-
configurator-$a7=$a8&s-configurator-$a9=$b0&s-configurator-$b1=$b2&s-
configurator-$b3=$b4&s-configurator-$b5=$b6&s-configurator-$b7=$b8&s-
configurator-$b9=$c0&s-configurator-$c1=$c2&s-cat_id=$2?
> break;
> 
> Выдает ошибку 500 interrnal server error а в error логе появляется ошибка
> pcre_exec() failed: -8
> 

Не мудрено, вы исчерпали PCRE_MATCH_LIMIT, и боюсь себе представить, каким
он должен быть для такой рекурсивной регулярки.

--
Валентин Бартенев

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


 




Copyright © Lexa Software, 1996-2009.