我想改变的网址:www.example.com/index.html?id=roy
到: www.example.com/roy
如何写nginx的主URL重写
我已经试过this solution,但它的URL:www.example.com/users/roy
我想改变的网址:www.example.com/index.html?id=roy
到: www.example.com/roy
如何写nginx的主URL重写
我已经试过this solution,但它的URL:www.example.com/users/roy
我解决了这个问题: try_files $ URI/$ URI /index.html?$query_string
请这给一试。这会将/(.+)
重写为/index.html?id=$1
。
rewrite ^/(.+)$ /index.html?id=$1 last;
试试这个,(使用无限的名称)
location/{
rewrite^http://www.example.com/users/$arg_id permanent;
}
我得到500内部服务器错误,当我输入www.somedomain.com时,为什么? – user3355127
请发布您的配置 –