0

Currently I have a directory that is down a bit in the codebase, I need to move it to a url that I use on the old server that uses Apache.

In Apache I have:

RewriteRule ^ait/(.*) system/ait/$1 [L,QSA]

I'm trying to write it in Nginx but can't seem to figure it out, I've tried the below.

location /ait/ {
    rewrite ^ait/(.*)$ /system/ait/ last;
}

And:

location /ait/(.*) {
    rewrite ^/system/ait/$1?$args permanent;
}

Any help greatly appreciated.

llanato
  • 211
  • 2
  • 4
  • 12

2 Answers2

2

Found the answer after much testing.

location /ait {
    rewrite ^/ait/(.*) /system/ait/$1 break;
}
llanato
  • 211
  • 2
  • 4
  • 12
0

You don’t need rewrite. Use root:

location /ait/ {
    root /path/to/system/;
}
Alexey Ten
  • 8,435
  • 1
  • 34
  • 36