rewrite help

Ray gunblad3 at gmail.com
Wed May 5 12:33:14 MSD 2010


How about this?

server {
       listen          80;
       server_name     yahoo.example.com;

       location / {
             rewrite ^(.*)$ http://www.example.com/site/yahoo$1 last;
       }
}

Ray.


On Wed, May 5, 2010 at 4:22 PM, Glen Lumanau <glen at lumanau.web.id> wrote:

> I tried
>
> server {
>        listen          80;
>        server_name     yahoo.example.com;
>
>        rewrite ^.+ http://www.example.com/site/yahoo$uri last;
> }
>
> However it's not rewrited. It's being redirected to
> http://www.example.com/site/yahoo
>
>
> -----Original Message-----
> From: Edho P Arief [mailto:edhoprima at gmail.com]
> Sent: 05 Mei 2010 15:16
> To: nginx at nginx.org
> Subject: Re: rewrite help
>
> On Wed, May 5, 2010 at 3:09 PM, Glen Lumanau <glen at lumanau.web.id> wrote:
> > Hi folks,
> >
> >
> >
> > I need a rewrite rules like this
> >
> >
> >
> > I have www.example.com, google.example.com, yahoo.example.com
> >
> >
> >
> > I need to rewrite
> >
> > Google.example.com à  www.example.com/site/google
> >
> > Yahoo.example.com à www.example.com/site/yahoo
> >
> >
> >
> > How can I do that?
> >
>
> separate server block with rewrite on each blocks
>
>
>
> --
> O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
>
> _______________________________________________
> 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/20100505/a82dd450/attachment.html>


More information about the nginx mailing list