0

I'm migrating an old site to a new structure, and have a bunch of these type rewrites:

location / {
 rewrite ^/foo.html /legacy-page? permanent;
 rewrite ^/bar.html /legacy-page? permanent;
 rewrite ^/org.html /legacy-page? permanent;
 rewrite ^/directory/foo.html /legacy-page? permanent;
 rewrite ^/directory2 /legacy-page? permanent;
 try_files $uri $uri/ /index.php?q=$uri&$args;
}

Is there a better / more efficient way to handle those /legacy-page rewrites?

1 Answer 1

0

Try:

rewrite ^/(foo|bar|org|directory/foo).html /legacy-page? permanent;
rewrite ^/directory2 /legacy-page2 permanent;
1
  • Thanks, cjc. is there a directory equivalent? that is every request to /directory2 , /directory3 , /etc. goes to /legacy-page? and - was the second rule destination (legacy-page2) a typo?
    – jimg
    Feb 2, 2012 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .