Redirect Rule

milin korath milinkorath at gmail.com
Sat Jul 9 20:11:42 MSD 2011


Hi
>
>
> location = /x/y {
>        # ... process it right here
>    }
> What should i need to write here.Sorry i am not familiar with nginx
> directives ..
> Thanks
>
>
>
> On Sat, Jul 9, 2011 at 6:53 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
>
>> Hello!
>>
>> On Sat, Jul 09, 2011 at 06:19:04PM +0530, milin korath wrote:
>>
>> > Hello
>> >
>> > I am running my djago application in nginx server. In my configuration I
>> > redirect all http to https using the below  settings
>> >
>> > location / { rewrite ^/(.*) https://mydomain.com/$1 permanent; }
>> >
>> > What i want is i need to redirect to all my http request to https
>>  except
>> > only one url like http://mydomain.com/x/y.
>> >
>> > I tried
>> >
>> > location ~* / {
>>
>> There is no need to use regexp here, just normal "location /" will
>> do the same thing.
>>
>> >     rewrite ^/(.*) https://mydomain.com/$1 permanent;
>>
>> Something like
>>
>>    rewrite ^ https://mydomain.com$request_uri? permanent;
>>
>> is a bit more effecient way to do the same thing.
>>
>> > }
>> >
>> > location = mydomain.com/x/y {
>>
>> You don't need "mydomain.com" here, just "location = /x/y".
>>
>> >     rewrite ^/(.*) http://mydomain.com/$1 permanent;
>>
>> And you don't need redirect here, as it will create infinite loop
>> as long as this is config for http part of mydomain.com.
>>
>> > }
>> >
>> > But no luck.Can you please advice me what went wrong here.Really i am
>> struck
>> > with this.
>>
>> Bringing all of the above together gives something like this:
>>
>>    location / {
>>        rewrite ^ https://mydomain.com$request_uri? permanent;
>>    }
>>
>>    location = /x/y {
>>        # ... process it right here
>>    }
>>
>> Maxim Dounin
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://nginx.org/mailman/listinfo/nginx
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110709/ce5ad334/attachment.html>


More information about the nginx mailing list