【发布时间】:2014-05-23 15:59:28
【问题描述】:
我想将网址:www.example.com/index.html?id=roy 更改为:
www.example.com/roy
我试过this solution,但它是针对url:www.example.com/users/roy
【问题讨论】:
标签: nginx url-rewriting rewrite
我想将网址:www.example.com/index.html?id=roy 更改为:
www.example.com/roy
我试过this solution,但它是针对url:www.example.com/users/roy
【问题讨论】:
标签: nginx url-rewriting rewrite
请试一试。这会将/(.+) 重写为/index.html?id=$1。
rewrite ^/(.+)$ /index.html?id=$1 last;
【讨论】:
我解决了这个问题: try_files $uri/ $uri /index.html?$query_string
【讨论】:
试试这个,(使用无限的名字)
location / {
rewrite ^ http://www.example.com/users/$arg_id permanent;
}
【讨论】: