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

I know about the HttpRewriteModule, but I don't really know how to handle regex and I would need to redirect all URLs within a certain directory to another, specifically


Could some one tell me how to do this in Nginx?

share|improve this question

1 Answer 1

up vote 13 down vote accepted

Do you mean something like:

rewrite ^/component(.*)$ $1 last;
share|improve this answer
I think this will do it, thank you so much. I'm awful at regular expressions; I will have to try to learn them... –  javipas Aug 18 '11 at 12:05 has explanation on the right side –  Jon Mar 25 at 11:13
You may need to replace last by break. (Last will try to resolve other locations after the rewrite). –  Thomas Decaux Apr 11 at 9:57

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.