rewrite rule needed for subdomains

Edho P Arief edhoprima at gmail.com
Thu Nov 5 10:34:40 MSK 2009


On Thu, Nov 5, 2009 at 1:10 AM, Mike Smith <lists at ruby-forum.com> wrote:
> Igor Sysoev wrote:
>> On Tue, Nov 03, 2009 at 10:19:09PM +0100, Mike Smith wrote:
>>
>>> >
>>> >     server {
>>> >         # a catchall server for "listen 80",
>>> >         # since it's "default" server for "listen 80"
>>> >
>>> >         listen 80 default;
>>> >         server_name  store1.domain.com;
>>> >
>>> >         location / {
>>> >             rewrite ^   http://$host/magento/$request_uri? last;
>>
>> Probably, you need
>>
>> -               rewrite ^   http://$host/magento/$request_uri? last;
>> +               rewrite ^   /magento$uri  last;
>
>
> When I do that and hit the following url
>
> http://www.domain.com/magento/shop/by/expert
>
> I see the following in the log
>
> 2009/11/04 13:07:38 [error] 22578#0: *1 rewrite or internal redirection
> cycle while processing "/magento/magento/shop/by/expert", client:
> 127.0.0.1, server: _, request: "GET /magento/shop/by/expert HTTP/1.1",
> host: "www.domain.com", referrer: "http://www.domain.com/"
>
>
>
> Here is my config
>
><the config>

of course it will be cyclic. You put the rewrite in wrong location.
also, if ( ) is evil.


-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org





More information about the nginx mailing list