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'm trying to redirect the following URL


To redirect to


Where "something" could be anything.

I've already set up nginx and Dns for wild card and confirmed that that works.

share|improve this question
up vote 1 down vote accepted

Where is an orthodox way:

location /category/ {
      location ~ ^/category/(?<category>.+)$ {
            return 302 http://$$category

Without "rewrite". Tested at nginx/1.0.0

share|improve this answer
This worked great. – drewrockshard Nov 7 '11 at 19:57

untested.. but should work

location / {
   rewrite  ^/category/(.*)$  http://$$1  permanent;
share|improve this answer
This didn't work - does the file or path have to exist or does nginx just route it as requested? – drewrockshard Nov 7 '11 at 19:50

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.