The desired effect is
abc.com/hello => abc.com/article.php?link=hello
abc.com/en/ = > abc.com/index.php?lang=en
abc.com/en/hello => abc.com/article.php?link=hello&lang=en
The current writing method is
location / {
try_files $uri $uri/ =404;
if (!-e $request_filename){
rewrite ^/(.*)$ /article.php?link= last;
}
}
location /en/ {
rewrite index index.php?lang=en;
rewrite ^/en/(.*)$ /article.php?link=&lang=en last;
}
The current problem is that abc.com/hello is no problem, abc.com/en/hello is also no problem, abc.com/en/ will be parsed as hello and errors will occur
/en/ is also used as a rewrite rule