想要实现的效果是
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
目前的写法是
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;
}
目前的问题是 abc.com/hello 是没问题的, abc.com/en/hello 也是没问题的, abc.com/en/会被当成 hello 那样解析出现错误
1
arnofeng 2015-08-27 13:20:35 +08:00 via Android 1
|
2
akira 2015-08-27 20:15:49 +08:00
拆开来写啊,干嘛非要写在一起
|