Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to take and direct those requests to with nginx. (The same nginx sever will be serving

Can someone help me with the config I would need? I can post my nginx.conf if needed, but I assume its something like:

location / { rewrite /([^/] +) /mobile/$1 break; proxy_pass; }

Am I in the right ballpark?

share|improve this question

You should use a server block for this to allow Nginx to use it's hash table lookup.

server {

    location / {
        rewrite ^$request_uri permanent;

    location /mobile {
        rewrite ^$request_uri permanent;
share|improve this answer
Will this account for links like How would I account for that? – kkubasik Oct 31 '10 at 0:14
Edited the code example. Now it will rewrite and to – Martin Fjordvald Oct 31 '10 at 3:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.