技术解析
想要实现的效果是
abc.com/hello => abc.com/article.php?lin抗投诉服务器k=hello
abc.com/en/ => abc.com/index.php?lang=en
abc.com/en/hello => abc.com/article.php?link=hello&lang=en
目前的写法是
location / {
try_files $uri $uri/ =404;
if (!-e $request_filename ){
rewrite ^/(.*)$ /article.php?link=$1 last;
}
}
location /en/ {
rewrite index index.php?lang=en;
rewrite ^/en/(.*)$ /article.php?link=$1&lang=en last;
}