Question about rewrite

Denis S. Filimonov den.lists at gmail.com
Sat Apr 5 12:25:19 MSD 2008


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.





More information about the nginx mailing list