Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 would like to rewrite requests to (.*).server.org to go to www.server.org/do/$1

Basically any request that comes in as: something.server.org should go to www.server.org/do/something

I would also like the ability to do something a little bit more clever: something1.something2.server.org should go to www.server.org/do/something1/something2/

so something like: (.).(.).server.org should go to www.server.org/do/$1/$2

Would anyone have some knowledge they can drop on me as to how to set this up with nginx?

thanks, Benny

share|improve this question
up vote 1 down vote accepted

Make sure your Nginx and PCRE version is up to date and then use server_name captures: http://nginx.org/en/docs/http/server_names.html#regex_names

share|improve this answer
    
Awesome. Thanks! – user56505 Oct 9 '10 at 3:05

Your Answer

 
discard

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