Question about rewrite

Sasa Ugrenovic nginx-mailing at infomedia.ba
Sat Apr 5 12:40:26 MSD 2008


Hey,

Be aware that the orginal User Agent line looks something like this:
"SonyEricssonW800i/R1BC Browser/SEMC-Browser/4.2 Profile/MIDP-2.0 Configuration/CLDC-1.1"

Do
>         if ($http_user_agent !~* "Profile/MIDP") {
this still stands ? I mean, Will it match the *profile/midp* ?

Kind Regards,
Sasa

On Sat, 5 Apr 2008 04:25:19 -0400
"Denis S. Filimonov" <den.lists at gmail.com> wrote:

> On Saturday 05 April 2008 04:00:10 Sasa Ugrenovic wrote:
> > Hello,
> >
> > I moved one site from apache to nginx, and I must say... Im very satisfied.
> > Wont get into details about that now, just to say - thanks on the cool
> > project.
> >
> > Anyway, to get to the point.
> > Im running mostly mobile site, so.. I don't wanna pc desktop users browsing
> > around, instead.. I want to redirect those users to another site.
> >
> > I did a little reasearch about that, and... the only option of how I can
> > match those users is the "Profile/MIDP" part of UserAgent string. 99 % of
> > wap browsers send that, and other 1% sends variations on that, like opera:
> > J2ME/MIDP. So I think thats the best deal.
> >
> > I created rules like this:
> >
> >        if ($http_user_agent !~* Profile/MIDP) {
> >                rewrite   ^/   http://www.anothersite.com/;
> >        }
> >
> > However, that aint working right. So obviously im doing something wrong.
> > Can someone help me how I can properly match that string ?
> 
>         if ($http_user_agent !~* "Profile/MIDP") {
>                 rewrite   ^/   http://www.anothersite.com/ last;
>         }
> 
> http://wiki.codemongers.com/NginxHttpRewriteModule#rewrite
> 
> -- 
> Denis.
> 
-- 
Sasa Ugrenovic <nginx-mailing at infomedia.ba>





More information about the nginx mailing list