views:

38

answers:

1

I have the following rewrite rule

rewrite ^/ab(.*)/(.*)$ /repo/ab$1/rtest/$2 break;

When the request file is /abname/index.php it gets rewritten to /abname/rtest/index.php

But if the request is of the form /abname/dir1/index.php it gets rewritten as /abname/dir1/rtest/index.php but I would want it to be rewritten as /abname/rtest/dir1/index.php

How do I write the rule ?

+1  A: 

You need avoid the / in your first match

rewrite ^/ab([^/]*)/(.*)$ /repo/ab$1/rtest/$2 break;
shingara
Thanks, that worked!
rampr