Nginx routing rule rewriting

the current environment is that index.php is used as the entry file in the php+nginx,php site directory, and the current route rewriting rule is:

location / {
  if (!-e $request_filename) {
    rewrite   ^(.*)$ /index.php?s=$1 last;
    break;
  }
}

now, the current domain name http://a.com accesses the website normally. Now I want http://a.com/test/ to access the website. How can I change it? The "/ test/" address field is not specified in the
code, but is intended to be rewritten on url.

Dec.23,2021

Thank you for the invitation.

although I have not done this requirement, I think we can try it with alias , for example:

rewrite   ^test/(.*)$ /index.php?s=$1 last
Menu