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

I would like to rewrite requests to (.*) to go to$1

Basically any request that comes in as: should go to

I would also like the ability to do something a little bit more clever: should go to

so something like: (.).(.) should go to$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

1 Answer 1

up vote 1 down vote accepted

Make sure your Nginx and PCRE version is up to date and then use server_name captures:

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

Your Answer


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