rewrite URL to subdomain

proforg proforg at maloletka.ru
Thu Sep 6 19:35:13 MSD 2007


параметры POST - не думаю, GET - вполне.

например как то так:

location /
         {
             if ($host ~* "^(\w+)\.domain\.com$")
             {
                 set $uid $1;
                 rewrite ^ http://domain.com/users/$uid/profile/$args  
redirect;
             }
         }

On 06.09.2007, at 19:06, Igor Askarov wrote:

> Здравствуйте, Igor.
>
> Вы писали 6 сентября 2007 г., 18:29:02:
>
>> On Thu, Sep 06, 2007 at 05:23:05PM +0300, Alexey Bobok wrote:
>
>>> Скорее всего вопрос уже был, но не нашел ответа.
>>> Можно ли средствами nginx сделать следующее:
>>> чтобы, при обращении на http://domain.net/foto/ , клиента  
>>> редиректило
>>> на http://foto.domain.com/
>>> не важно, что идет после /foto/ - все тупо редиректить в субдомен.
>
>>      location /foto/ {
>>          rewrite   ^   http://foto.domain.com/?;
>>      }
>
>
>
> А как сделать похожее, только наоборот + чтобы сохранялась строка
> запроса и POST-GET-параметры?
>
> То есть
>
> http://joe.domain.com/profile/?mode=list --> http://domain.com/ 
> users/joe/profile/?mode=list
>
> -- 
> С уважением,
>  Igor                          mailto:juks at juks.ru
>
>

Алексей Бещёков
Email/JID: proforg at maloletka.ru



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2423 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20070906/8d4ae6cb/attachment.bin>


More information about the nginx-ru mailing list