url-rewrite - nginx rewrite conflict resolution
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 17:22:08
0
1
522

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

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(1)
刘奇

/en/ is also used as a rewrite rule

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template