ПРОЕКТЫ 


  АРХИВ 


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: Правило с двумя признаками для rewrite


  • To: nginx-ru@xxxxxxxxx
  • Subject: Re: Правило с двумя признаками для rewrite
  • From: "Mykola S. Grechukh" <gns@xxxxxxxxxxx>
  • Date: Tue, 27 Nov 2007 14:12:42 +0200
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=cBN4vEoR5RCL4pzRtj2DDsbAPUvtDIglez449LEEtdc=; b=JWbJ6vW4oY1jG4RAbnldNzyTWtJ9ByZNV9YRbaZE8EOyBFUf02Wle0+NBvd72md/I4bISMmw99ufeqjOIcAWjvt8yHCaxRPI9jIPKtzpMjaJs1puN1OWiFKvVy/6ZPoxcXH7vq8T0X65wH9RQKbWWFj27ivk4LAtEdCSke/nMAs=
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=DYOujRLZGorpSwbiNjnJRTzfmhS5K1Dp4CosA44BBipt4JfVx1+yvfjhwjEYkOLUL1Emv0wI83lqJD2V0zuRQnhKX0EzcC08zBx7m48u0Otcp53QtAdE30E18o6oB/Z0O365Sig6i/itU9kD9RVxVFJYpSv0Oa398+BVNm/KO/A=
  • In-reply-to: <E1IwwGt-000DmM-16@xxxxxxxxxxxx>
  • References: <E1IwwGt-000DmM-16@xxxxxxxxxxxx>

2007/11/27, Egorov <>:
> Мне нужно вот такой URL:
>
>
> http://host.com/index.php/cPath/images/picture.jpg
> (jpg, gif, png)
>
> http://host.com/product_info.php/cPath/90_101/products_id/images/picture.gif
>
> превратить в такой:
>
>             http://host.com/images/picture.jpg
>
> У меня не получается написать правило rewrite , которое определяло бы
> наличие двух
> признаков - .php и  jpg или gif.
> И вырезать из неё лишнее - в первом случае /index.php/cPath", а во втором
> "/product_info.php/cPath/90_101/products_id"

rewrite ^/(index|product_info)\.php/.*/images/(.*\.(jpg|png|gif))$ /images/$2;

проверяем:
gns@dell-mgr ~/tmp $ ll /var/www/*.php
zsh: no matches found: /var/www/*.php

gns@dell-mgr ~/tmp $ ll /var/www/images
total 112
drwxr-xr-x 2 root root  4096 2007-11-27 14:09 ./
-rw-r--r-- 1 root root 85608 2007-11-27 14:09 putin6.jpg
-rw-r--r-- 1 root root 14817 2007-11-27 14:00 cmc2.png

gns@dell-mgr ~/tmp $ wget
http://localhost/product_info.php/some/long/path/images/putin6.jpg
14:08:50 (115.06 MB/s) - `putin6.jpg.4' saved [85608/85608]


 




Copyright © Lexa Software, 1996-2009.