I am trying to setup my nginx to redirect all the requests from mobile devices to /mobile/$uri i came up with this solution but it doesn\'t seem to work. Is it a syntax problem
You should use different locations:
location / { if ($http_user_agent ~* '(iPhone|iPod|android|blackberry)') { return 301 /mobile$request_uri; } } location /mobile/ { }
btw, http://nginx.org/r/return