Question about rewrite

Sasa Ugrenovic nginx-mailing at
Sat Apr 5 12:00:10 MSD 2008


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   ^/;

However, that aint working right. So obviously im doing something wrong.
Can someone help me how I can properly match that string ?


More information about the nginx mailing list