nginx rewrite help

Edho P Arief edhoprima at gmail.com
Thu Jun 18 08:49:24 MSD 2009


On Thu, Jun 18, 2009 at 11:46 AM, Edho P Arief<edhoprima at gmail.com> wrote:
> On Thu, Jun 18, 2009 at 11:42 AM, Edho P Arief<edhoprima at gmail.com> wrote:
>> On Thu, Jun 18, 2009 at 11:22 AM, Kevin
>> Castiglione<kevincastiglione at gmail.com> wrote:
>>> hei guys
>>> i want all urls to be re-written as follows:
>>>
>>> xx /host/xx
>>>
>>> xx is the url full path, it should be written as /domain/xx where host is
>>> the hostname.
>>>
>>> for example www.ABCD.COM
>>>
>>> /test?1 ---> /ABCD.COM/test?1
>>> is it possible to do this with nginx?
>>> thank you!
>>
>> rewrite ^(.*)$ /$host$1;
>>
>
> add redirect/permanent for external redirect.
>
> rewrite ^.* /$host$uri;
>
> can also be used (less captures hence faster?)
>

whoops don't forget to add last;

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





More information about the nginx mailing list